Update chapter11 for MicroProfile Rest Client 4.0#64
Open
ttelang wants to merge 1 commit intomicroprofile:mainfrom
Open
Update chapter11 for MicroProfile Rest Client 4.0#64ttelang wants to merge 1 commit intomicroprofile:mainfrom
ttelang wants to merge 1 commit intomicroprofile:mainfrom
Conversation
Updated chapter content to reflect MicroProfile Rest Client 4.0 features and improvements, including changes in dependency versions, new annotations, and enhanced configuration options.
jamezp
reviewed
Mar 31, 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. |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.*` |
|
|
||
| **Requirements:** | ||
|
|
||
| * Both `@Inject` and `@RestClient` are required in MicroProfile 4.0 |
There was a problem hiding this comment.
I think this should be:
Both
@Injectand@RestClientare 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) |
There was a problem hiding this comment.
I think we should remove the priority from here or the @Priority annotation. It seems redundant to use both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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