7 Key Features Introduced in Jakarta EE 10
Jakarta EE 10, now governed by the Eclipse Foundation, brings vendor‑neutral APIs and seven notable enhancements—including managed executor definitions, a new @Asynchronous annotation, multipart/form‑data support, OpenID authentication, UUID primary keys, expanded numeric and date‑time functions, and a pure‑Java view for Jakarta Faces—while inviting community contributions for its upcoming final release.
Java EE has been renamed Jakarta EE and transferred to the Eclipse Foundation, opening the specification to open governance, open compatibility testing, and a vendor‑neutral ecosystem where the same application code can run on any Jakarta EE‑compliant server such as WildFly, Payara, or WebSphere.
1. @ManagedExecutorDefinition
The Jakarta Concurrency API’s ManagedExecutorService can now be configured via the @ManagedExecutorDefinition annotation, eliminating vendor‑specific XML. The annotation defines the thread‑pool name, context, hung‑task threshold, and max async tasks.
package ca.bazlur;
import jakarta.enterprise.concurrent.ManagedExecutorDefinition;
import jakarta.enterprise.concurrent.ManagedExecutorService;
import jakarta.enterprise.concurrent.ContextServiceDefinition;
import jakarta.annotation.Resource;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Named;
import java.time.Duration;
import java.time.LocalDate;
import java.util.concurrent.CompletableFuture;
@Named
@ApplicationScoped
@ManagedExecutorDefinition(
name = "java:module/concurrent/MyExecutor",
context = "java:module/concurrent/MyExecutorContext",
hungTaskThreshold = 120000,
maxAsync = 5)
@ContextServiceDefinition(
name = "java:module/concurrent/MyExecutorContext",
propagated = {SECURITY, APPLICATION})
public class WorkService {
@Resource(name = "java:app/concurrent/MyExecutorService")
private ManagedExecutorService executor;
@Asynchronous
public CompletableFuture<Long> hoursWorked(LocalDate from, LocalDate to) {
return CompletableFuture.supplyAsync(() -> heavyAPICall(from, to), executor);
}
private static long heavyAPICall(LocalDate from, LocalDate to) {
return Duration.between(from, to).toMillis();
}
}2. @Asynchronous
Previously available only on EJB methods, the new jakarta.enterprise.concurrent.Asynchronous annotation works on any CDI bean and allows explicit executor selection, avoiding the default server thread pool.
package ca.bazlur;
import jakarta.enterprise.concurrent.Asynchronous;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Named;
import java.util.concurrent.CompletableFuture;
@Named
@ApplicationScoped
public class PaymentService {
@Asynchronous(executor = "java:app/concurrent/MyExecutorService")
public CompletableFuture<Confirmation> processPayment(final Order order) {
try {
var status = processOrder(order);
return CompletableFuture.completedFuture(status);
} catch (PaymentException ex) {
throw new CompletionException(ex);
}
}
private Confirmation processOrder(Order order) { return new Confirmation(); }
}3. Multipart/Form‑Data Support
Jakarta REST 3.1 adds native handling of multipart/form‑data, removing the need for servlet‑based or vendor‑specific APIs.
package ca.bazlur;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.FormParam;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.EntityPart;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import java.io.InputStream;
@Path("/job")
public class FileResource {
@POST
@Path("/apply")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response applyForJob(@FormParam("name") String name,
@FormParam("recentPhoto") EntityPart photo,
@FormParam("resume") EntityPart resume) {
processApplication(name, photo.getMediaType(), photo.getContent(),
resume.getMediaType(), resume.getContent());
return Response.ok("Application received").build();
}
private void processApplication(String name, MediaType mt1, InputStream c1,
MediaType mt2, InputStream c2) { /* ... */ }
}4. @OpenIdAuthenticationDefinition
Jakarta Security 3.0 introduces a standard annotation for OpenID Connect authentication, allowing developers to configure provider URI, client ID, secret, redirect URI, and extra parameters directly on a class.
@OpenIdAuthenticationDefinition(
providerURI = "https://sample-openid-server.com",
clientId = "87068hgfg5675htfv6mrucov57bknst.apps.sample.com",
clientSecret = "{my-secret}",
redirectURI = "${baseURL}/callback",
extraParameters = {"testKey=testValue","testKey2=testValue2"})
public class SecurityConfig { }5. UUID Primary Key Support
Jakarta Persistence 3.1 adds java.util.UUID as a basic field type, enabling portable UUID identifiers for entities in cloud environments.
package ca.bazlur;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import java.util.UUID;
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
private UUID id;
private String username;
private String password;
}6. New Numeric and Date‑Time Functions
Jakarta Persistence 3.1 expands the JPQL function library with numeric functions (CEILING, EXP, FLOOR, LN, POWER, ROUND, SIGN), java.time based functions for LOCAL DATE/TIME/DATETIME, and an EXTRACT function to pull specific parts (year, month, day, hour, etc.) from date values.
7. Jakarta Faces 4.0 Pure‑Java Views
Jakarta Faces 4.0 introduces an API that lets developers define full HTML views using only Java code, eliminating the need to write separate markup languages.
Conclusion
The article invites developers to join the independent Jakarta EE Ambassador community and contribute to the platform’s evolution. The final Jakarta EE 10 release is slated for the next month, with further details available on the Jakarta EE 10 release roadmap.
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.
