Skip to content

Update chapter11 for MicroProfile Rest Client 4.0#64

Open
ttelang wants to merge 1 commit intomicroprofile:mainfrom
ttelang:chapter-update-mp-restclient-4-0
Open

Update chapter11 for MicroProfile Rest Client 4.0#64
ttelang wants to merge 1 commit intomicroprofile:mainfrom
ttelang:chapter-update-mp-restclient-4-0

Conversation

@ttelang
Copy link
Copy Markdown
Contributor

@ttelang ttelang commented Feb 20, 2026

Summary

Update the MicroProfile Tutorial chapter to align with MicroProfile Rest Client 4.0. The chapter content has been updated to reflect current REST client capabilities, including updated dependency versions, newer/updated annotations, and improved configuration guidance.

What changed

  • Updated chapter content to match MicroProfile Rest Client 4.0
  • Refreshed dependency/version references where applicable
  • Incorporated relevant annotation and configuration updates introduced in 4.0
  • General content cleanup to ensure examples and tutorial sections remain accurate

Updated chapter content to reflect MicroProfile Rest Client 4.0 features and improvements, including changes in dependency versions, new annotations, and enhanced configuration options.
@ttelang ttelang marked this pull request as ready for review February 20, 2026 20:13
@ttelang ttelang changed the title Revise chapter for MicroProfile Rest Client 4.0 Update chapter11 for MicroProfile Rest Client 4.0 Feb 20, 2026
In microservices architecture, developers often face the cumbersome task of implementing boilerplate code to consume REST APIs - manually constructing HTTP requests, parsing responses, and handling errors. The MicroProfile Rest Client specification addresses this by leveraging Jakarta RESTful Web Services (formerly JAX-RS) annotations to create type-safe Rest client interfaces. Instead of writing low-level HTTP logic, developers define Java interfaces that mirror the target service’s endpoints. At runtime, MicroProfile Rest Client dynamically generates an implementation of these interfaces, automating HTTP communication with compile-time type safety.

This chapter introduces the MicroProfile Rest Client, a type-safe framework for simplifying service-to-service communication. We will begin by defining REST client interfaces using Jakarta RESTful Web Services annotations (`@GET`, `@Path`), configuring endpoints via MicroProfile Config, and implementing HTTP invocation. Next, we will explore handling HTTP communication, processing responses, and error handling. By the end of this chapter, you will be able to replace hand-written HTTP boilerplate code with declarative, maintainable clients while adhering to Jakarta EE and MicroProfile standards.
This chapter introduces MicroProfile Rest Client 4.0, a type-safe framework aligned with Jakarta EE 10 for simplifying service-to-service communication. You'll learn to define and inject REST client interfaces, configure clients with MicroProfile Config, handle errors with `ResponseExceptionMapper`, and implement custom filters.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "aligned with Jakarta EE 10" or "aligned with "Jakarta RESTful Web Services 3.1"?


== What's New in MicroProfile Rest Client 4.0

MicroProfile Rest Client 4.0 aligns with Jakarta EE 10 and includes these key changes:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here about the EE version vs the specification version.


* **Mandatory `@RestClient` qualifier** - Required for CDI injection to prevent ambiguous bean resolution
* **Enhanced `RestClientBuilder`** - New `baseUri(String)` method accepts a String directly without `URI.create()`
* **Namespace migration** - All `javax.*` packages migrated to `jakarta.*`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was done in 3.0.


**Requirements:**

* Both `@Inject` and `@RestClient` are required in MicroProfile 4.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be:

Both @Inject and @RestClient are required in MicroProfile Rest Client

Keeping the version is fine, but it will require additional maintenance going forward. The addition of "Rest Client" seems necessary though.

[source,java]
----
@RegisterRestClient(configKey = "product-service")
@RegisterProvider(value = AuthenticationFilter.class, priority = 1000)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove the priority from here or the @Priority annotation. It seems redundant to use both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants