Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Migrating to Jakarta EE 10
1. Josh Juneau - 1/26/2024
Migrating to Jakarta EE 10
Whirlwind Tour of Jakarta EE 10
2. About Me
• Software Engineer
• Database Administrator
• Author, Blogger, Podcaster
• Apache NetBeans Committer
• JCP and Jakarta EE Ambassadors
3. Overview
What will we cover?
• What has changed from Jakarta EE 8 through Jakarta EE 10
• Demonstrate some great features of Jakarta EE 10
• How to update projects from Jakarta EE 8 to Jakarta EE 10
• What is coming in the next release
4. Changes in Jakarta EE
Updates from Jakarta EE 8 through Jakarta EE 10
• Java EE open sourced to the Eclipse Foundation -> Jakarta EE
• Jakarta EE 8 aligned with Java EE 8
• Jakarta EE 9 - Namespace changes from javax.* to jakarta.*
• Java SE 11 available in Jakarta EE 9.1+
• Jakarta EE 10 - Java SE 17
• Many new features!
5. Getting Started with Jakarta EE 10
• Download Jakarta EE 10 compatible container
• Payara 6
• Glass
fi
sh 7
• Declare Maven dependencies within the project POM
fi
le
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
6. What is New in Jakarta EE 10?
Why should I upgrade?
• Modern APIs for development of REST services and front ends
• Java SE 17 support…must use Java SE 11 or later
• Pro
fi
le Changes in Jakarta EE 10
• Web Pro
fi
le: Added concurrency and resource management
• (New) Core Pro
fi
le: Targets small runtimes, including only speci
fi
cations that
target web service development
• Full Platform: 22 of 30 speci
fi
cations updated; 1 new speci
fi
cation
7.
8. What’s New in Jakarta EE 10
Concurrency
• Now included in Web Pro
fi
le
• Asynchronous methods
• Context changes including propagation to parallel streams operations and
ability to reference context from completion stages and completable futures
• Ability to propagate third party context types
• Modernization of APIs
9. Context Propagation
Concurrency
@ContextServiceDe
fi
nition(
name = "java:app/concurrent/myContext",
propagated = { SECURITY, APPLICATION, VENDOR1_CTX })
@ManagedScheduledExecutorDe
fi
nition(
name = "java:comp/concurrent/myExecutor",
context = "java:app/concurrent/myContext",
maxAsync = 5)
public class MyServlet …
10. What’s New in Jakarta EE 10
Jakarta Faces
• Scope binding to browser window or tab
• Utilization of @ClientWindowScoped annotation can bind scope of
application to a single browser window or tab
• Automatic extensionless mapping
• No need for providing extensions of .xhtml or other
• Views created in pure Java
• JSP and Managed Beans No Longer Supported
11. What’s New in Jakarta EE 10
CDI
• Empty beans.xml marked as implicit bean archive
• Bean-discovery-mode default to “annotated”
• New jakarta.enterprise:jakarta.enterprise.lang-model API
• Java Platform Module System module-info.class
fi
les added to artifacts
• Core Restructured: CDI Full and CDI Lite
• Lite is build-time compatible, utilization of the new
BuildCompatibleExtensions interface
12. What’s New in Jakarta EE 10
CDI Lite - Contains most of full spec…here is what is missing
• Session and Conversation scoped beans
• Parts of the BeanManager API
• Per-bean archive enablement (decorators, interceptors, alternatives)
• Interceptors bound using @Interceptors
• Explicit bean archives
• @AroundInvoke interceptors declared on target classes
• Portable extensions
• Decorators, specialization, and passivation
13. What’s New in Jakarta EE 10
Expression Language
• BeanELResolver updates
• LambdaExpressions and Arrays can now be coerced
• Generics now included in API
• MethodReference can now be used to access method details
14. Spec Overview and What’s New
JSON Binding
Standard binding layer for converting Java objects to/from JSON
• Serialize/deserialize objects to/from JSON
• Mapping of primitive types, serialization of collections and maps
Latest Additions
• Dropping of @JsonbCreator parameters, deprecation of @JsonbProperty.nillable()
• Deserialization of null values to JsonValue.NULL_VALUE
• Support for polymorphic types
• Support for parameter or type annotation usage of JsonbTypeDeserializer and
JsonbTypeAdapter
15. Spec Overview
JSON Processing
API used to parse, transform, and query JSON data using the object or
streaming model.
Some examples:
• JsonObjectBuilder is used to build a JSON object
• Call upon the Json.createObjectBuilder() method to create a
JsonObjectBuilder
• Similarly, call upon Json.createArrayBuilder() method to create a JsonArray
16. What’s New in Jakarta EE 10
JSON Processing - Latest Additions
• New APIs introduced for creating JsonValue object from primitive types
• JsonNumber, JsonString, JsonArray, JsonObject
• Standard property added to handle duplicate keys:
JsonCon
fi
g.KEY_STRATEGY
• Clari
fi
ed behavior of JsonObjectBuilder.build() and JsonGenerator.close()
17. Example
JSON Processing - Example of Pointer and Patch
JSON Pointer and JSON Patch
● JSON Pointer allows one to point to a particular element within a JSON Structure
● Utilize JSON Patch to replace a speci
fi
ed value within a JSON document with another value.
● Editing/Transformation Operations Added to the JSON Object Model
● JSON de
fi
nes only two data structures: Objects, Arrays
● JSON de
fi
ne seven value types: String, number, object, array, true, false, null
•
18. Spec Overview
Security
Standard Security Provided
● Ability to apply across multiple identity stores: Database, LDAP, Embedded
● Annotations for ease of development
● Remembers caller (cookie, identity store)
● Group to Role Mapping
● Standard expression language accessors
● Simpli
fi
ed HttpAuthenticationMechanism interface with three default
implementations:
- Basic, form, LDAP
19. What’s New in Jakarta EE 10
Security
• OpenID Connect Authentication
• New wrappers for HttpAuthenticationMechanism and IdentityStore
20. What’s New in Jakarta EE 10
Jakarta REST - Latest Additions
• Better JSONB Alignment
• @Context is deprecated
• Automatic provider extension loading
• Support for Multipart/Form Data
• Jakarta.ws.rs.core.EntityPart
• Default Exception Mapper if one is not provided
21. Strategies for Upgrade to Jakarta EE 10
• Manual Upgrade
• Use of Utilities
• Eclipse Transformer
• Payara
• OpenRewrite and WindUp
• Tomcat Migrator
• IDE (IntelliJ Upgrade Utility)
22. Manually Upgrading Application
• Modify POM dependencies
• Modify XML
fi
les with Jakarta EE 10 schema updates
• Make namespace adjustments to Java imports
• Modify XHTML
fi
les with Jakarta EE 10 namespace updates
• Address any code changes that need to be made (annotations, rewrite to use
newer APIs)
• Recompile and Deploy to Jakarta EE 10 compatible container
24. Documentation and Resources
• OmniFish Migration Examples:
• https://github.com/OmniFish-EE/upgrading-jakarta-ee-applications
• Payara Upgrade Advisor
• mvn
fi
sh.payara.advisor:advisor-maven-plugin:1.0:advise
25. What is Coming In Jakarta EE 11?
Jakarta EE 11 Due - Targeted June/July 2024
• Support for Java Records
• Support for Virtual Threads
• Jakarta Data 1.0
• Java SE 21 Support