5 Must‑See New Features in Jakarta EE 10
Jakarta EE 10 introduces five standout enhancements—full Multipart support for REST services, new query functions in Jakarta Persistence, built‑in OpenID Connect authentication, a pure‑Java API for Jakarta Faces views, and a modern CompletableFuture‑based asynchronous API—each illustrated with code samples and references.
Support for Multipart Media Types in REST Services
Jakarta RESTful Web Services 3.1 fully supports the multipart/form-data media type. A server can consume a list of EntityPart instances or individual parts by name, and a client can send multipart payloads using the same type.
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response postAsList(List<EntityPart> parts) { … }
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response postAsParts(@FormParam("part1") String part1,
@FormParam("part2") EntityPart part2) { … }Responses may also return a list of EntityPart. On the client side, a list of parts is posted as follows:
List<EntityPart> parts = …
WebTarget target = client.target("http://localhost:8080/multipart");
Response response = target.request()
.post(Entity.entity(parts, MediaType.MULTIPART_FORM_DATA));Andy McCright, “What’s coming in Jakarta REST 3.1” – https://dev.to/andymc12/what-s-coming-in-jakarta-rest-3-1-ole
New Query Functions in Jakarta Persistence
Jakarta Persistence 3.1 adds several SQL‑style functions to JPQL and the Criteria API, grouped into three categories:
Numeric functions: CEILING, EXP, FLOOR, LN, POWER, ROUND, SIGN Date‑time functions returning java.time values: LOCAL_DATE, LOCAL_DATETIME, LOCAL_TIME Extraction functions: EXTRACT(YEAR …), EXTRACT(QUARTER …), EXTRACT(MONTH …), EXTRACT(WEEK …), EXTRACT(DAY …), EXTRACT(HOUR …), EXTRACT(MINUTE …), EXTRACT(SECOND …) It also permits java.util.UUID as a basic field type, simplifying entity identifiers:
@Id @GeneratedValue(strategy = GenerationType.UUID)
private java.util.UUID id;Lukas Jungmann, “What’s new in Jakarta Persistence 3.1” – https://newsroom.eclipse.org/eclipse-newsletter/2022/march/what%E2%80%99s-new-jakarta-persistence-31
OpenID Connect Provider Login
Jakarta Security 3.0 adds native OpenID Connect support, allowing applications to authenticate via external providers (e.g., Google, Facebook) or a self‑hosted provider. Adding the @OpenIdAuthenticationDefinition annotation to a CDI bean configures the provider:
@OpenIdAuthenticationDefinition(
providerURI = "https://accounts.google.com",
clientId = "${config.clientId}",
clientSecret = "${config.clientSecret}",
redirectURI = "${baseURL}/callback")
@ApplicationScoped
public class SecurityBean { }The underlying API has been part of the Payara Platform since 2018 and is now standardized in Jakarta EE 10.
Payara blog, “OpenID Connect in the Payara Platform” – https://blog.payara.fish/openid-connect-in-the-payara-platform-5.183
Pure‑Java API for Jakarta Faces Views
Jakarta Faces 4.0 introduces an API that lets developers build entire UI views using only Java code, eliminating the need for XHTML facelets or JSP pages. The API leverages Java 11 language features such as lambdas and control‑flow statements to construct component trees programmatically.
HtmlForm form = components.create(HtmlForm.COMPONENT_TYPE);
body.getChildren().add(form);
HtmlOutputText message = components.create(HtmlOutputText.COMPONENT_TYPE);
form.getChildren().add(message);
HtmlCommandButton actionButton = components.create(HtmlCommandButton.COMPONENT_TYPE);
actionButton.addActionListener(e -> message.setValue("Hello, World"));
actionButton.setValue("Do action");
form.getChildren().add(actionButton);A new @ClientWindowScoped annotation ensures CDI beans survive across URL changes within the same browser tab, complementing the existing @ViewScoped.
Bauke Scholtz, “What’s new in Faces 4.0” – https://balusc.omnifaces.org/2021/11/whats-new-in-faces-40.html?m=1
Modern Asynchronous API with CompletableFuture
Jakarta Concurrency 3.0 adds the jakarta.enterprise.concurrent.Asynchronous annotation, enabling CDI methods to run on a managed executor without explicit task submission. Methods can now return CompletionStage<T> or CompletableFuture<T>, allowing fluent chaining and error handling.
@Asynchronous
public CompletableFuture<Double> hoursWorked(LocalDate from, LocalDate to) {
// ... compute result ...
return Asynchronous.Result.complete(result);
}Clients invoke the method and attach callbacks:
bean.hoursWorked(from, to)
.thenAccept(hours -> log("Worked " + hours + "."));Additional Concurrency 3.0 features include:
Cron‑based triggers with time‑zone support
Concurrent resource definitions for applications
Managed‑context execution of completion stages
Support for ForkJoinPool threads and parallel streams within the managed context
General Jakarta EE 10 Improvements
All implementations require Java 11.
Support for the Java Platform Module System (JPMS) with module descriptors for each API.
Enhanced CDI coordination, making CDI the backbone of many specifications.
Legacy features have been replaced by more modern alternatives.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
JakartaEE China Community
JakartaEE China Community, official website: jakarta.ee/zh/community/china; gitee.com/jakarta-ee-china; space.bilibili.com/518946941; reply "Join group" to get QR code
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
