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.

JakartaEE China Community
JakartaEE China Community
JakartaEE China Community
7 Key Features Introduced in Jakarta EE 10

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.

Jakarta Faces pure Java view example
Jakarta Faces pure Java view example

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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ConcurrencyUUIDrestjakarta-eeOpenIDJava EEJakarta EE 10jakarta-faces
JakartaEE China Community
Written by

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

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.