SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
What's new and noteworthy in Java EE 8?
Expertenkreis Java, 05.12.2017, GEDOPLAN
Dirk Weil, GEDOPLAN GmbH
Dirk Weil
GEDOPLAN GmbH, Bielefeld
GEDOPLAN IT Consulting
Konzeption, Realisierung von IT-Lösungen
GEDOPLAN IT Training
Seminare in Berlin, Bielefeld, on-site
Java EE seit 1998
Vorträge, Veröffentlichungen
What's new and noteworthy in Java EE 8? 2gedoplan.de
New and noteworthy in CDI 2.0
Observer ordering
What's new and noteworthy in Java EE 8? 3gedoplan.de
@ApplicationScoped
public class EventObserver {
void a(@Observes @Priority(Interceptor.Priority.APPLICATION + 1) DemoEvent e) {
…
}
void b(@Observes @Priority(Interceptor.Priority.APPLICATION + 2) DemoEvent e) {
…
}
@ApplicationScoped
public class EventProducer {
@Inject
Event<DemoEvent> eventSource;
public void fireSyncEvent() {
this.eventSource.fire(new DemoEvent());
New and noteworthy in CDI 2.0
Asynchronuous
events
What's new and noteworthy in Java EE 8? 4gedoplan.de
@ApplicationScoped
public class EventObserver {
void x(@ObservesAsync DemoEvent e) {
…
}
void y(@ObservesAsync DemoEvent e) {
…
}
@ApplicationScoped
public class EventProducer {
@Inject
Event<DemoEvent> eventSource;
public void fireAsyncEvent() {
CompletionStage<DemoEvent> completionStage
= this.eventSource.fireAsync(new DemoEvent());
New and noteworthy in CDI 2.0
SE container
What's new and noteworthy in Java EE 8? 5gedoplan.de
SeContainerInitializer seContainerInitializer
= SeContainerInitializer.newInstance();
try (SeContainer container = seContainerInitializer.initialize()) {
HelloWorldService helloWorldService
= container.select(HelloWorldService.class).get();
this.log.debug(helloWorldService.getHelloWorld());
}
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-shaded</artifactId>
<version>3.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-se</artifactId>
<version>2.0.2</version>
</dependency>
New and noteworthy in CDI 2.0
Java 8 alignment
Repeatable qualifier annotations
Instance.stream()
Various minor adjustments
No context control in SE 
What's new and noteworthy in Java EE 8? 6gedoplan.de
New and noteworthy in Bean Validation 2.0
New constraints
@Email, @NotEmpty, @NotBlank, @Positive,
@PositiveOrZero, @Negative, @NegativeOrZero,
@PastOrPresent, @FutureOrPresent
Container element constraints
Java 8 alignment
Repeatable constraint annotations
Support for Java 8 date and time types
Support for Optional<T>
What's new and noteworthy in Java EE 8? 7gedoplan.de
List<@Positive @Max(6) Integer> marks;
Optional<@Email String> getEmail() {
…
}
New and noteworthy in JPA 2.2
Java 8 alignment
Repeatable annotations
Support for LocalDate, LocalDateTime, LocalTime,
OffsetDateTime, OffsetTime
Query.getResultStream()
Allow CDI injections into AttributeConverter
What's new and noteworthy in Java EE 8? 8gedoplan.de
public class Employee {
@AttributeOverride(name = "street", column = @Column(name = "HOME_STREET"))
@AttributeOverride(name = "zipCode", column = @Column(name = "HOME_ZIPCODE"))
@AttributeOverride(name = "city", column = @Column(name = "HOME_CITY"))
private Address homeAddress;
public class DocumentRepository {
public Stream<Document> findAllAsStream() {
return entityManager
.createQuery("select x from Document x", Document.class)
.getResultStream();
New and noteworthy in JSF 2.3
Java Time Support in <f:convertDateTime>
CDI integration
Deprecate javax.faces.bean
Allow injection of specific JSF artifacts (e.g. FacesContext)
Support CDI injections into converters
What's new and noteworthy in Java EE 8? 9gedoplan.de
<h:outputText id="founded" value="#{countryPresenter.someCountry.founded}">
<f:convertDateTime type="localDate"/>
</h:outputText>
public class Country {
private LocalDate founded;
@FacesConverter(forClass = Country.class, managed = true)
public class CountryConverter implements Converter<Country> {
@Inject
CountryRepository countryRepository;
New and noteworthy in JSF 2.3
Websocket integration
What's new and noteworthy in Java EE 8? 10gedoplan.de
<f:websocket
channel="ticker"
onmessage="function(message) {
document.getElementById('coolNewFeature').value=message;
}" />
<h:inputText id="coolNewFeature" value="" size="25" readonly="true" />
public class TickerEndpoint {
@Inject
@Push(channel = "ticker")
private PushContext channel;
public void tick() {
String message = …
this.channel.send(message);
New and noteworthy in JSF 2.3
Multi-field validation
Use non-default
bean validation
group for one or
more input fields
Use <f:validateWholeBean> after input fields
Enable feature in web.xml
Works by validating a temporary copy
Not working on GlassFish 5 
Incredibly bloated 
What's new and noteworthy in Java EE 8? 11gedoplan.de
<h:inputText value="#{questionnaire.email}">
<f:validateBean validationGroups="InitialInput" />
</h:inputText>
<h:inputText value="#{questionnaire.comment}">
<f:validateBean validationGroups="InitialInput" />
</h:inputText>
<f:validateWholeBean value="#{questionnaire}"
validationGroups="InitialInput" />
New and noteworthy: JSON-B 1.0
Java – JSON binding
Similar to JAXB
Mapping annotations
@JsonbVisibility
@JsonbNillable
@JsonbTransient
@JsonbTypeAdapter
@JsonbDateFormat
@JsonbNumberFormat
What's new and noteworthy in Java EE 8? 12gedoplan.de
@JsonbNillable
public class Country {
private String id;
private String name;
@JsonbTypeAdapter(ContinentConverter.class)
private Continent continent;
@JsonbTransient
private String dummy = "unused";
New and noteworthy: JSON-B 1.0
(De)serialization API: JsonbBuilder, Jsonb
Configuration:
Class level annotations (@JsonbNillable, …)
JsonbConfig
What's new and noteworthy in Java EE 8? 13gedoplan.de
Country country = …
try (Jsonb jsonb = JsonbBuilder.create()) {
String json = jsonb.toJson(country);
…
} String json = …
try (Jsonb jsonb = JsonbBuilder.create()) {
Country country = jsonb.fromJson(json, Country.class);
…
}
JsonbConfig jsonbConfig = new JsonbConfig().withFormatting(true);
Jsonb jsonb = JsonbBuilder.create(jsonbConfig);
New and noteworthy in Servlet 4.0
HTTP/2 support
Header compression
Request multiplexing:
Allow multiple parallel requests on same connection
Server push:
Send content probably needed in advance
In general „behind the scenes“
What's new and noteworthy in Java EE 8? 14gedoplan.de
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
PushBuilder pushBuilder = req.newPushBuilder();
if (pushBuilder != null) {
pushBuilder.path("/dummy.css").push();
}
…
New and noteworthy in JAX-RS 2.1
Reactive client support
What's new and noteworthy in Java EE 8? 15gedoplan.de
Client client= ClientBuilder.newClient();
CompletionStage<String> planetearthCompletionStage = client
.path("http://localhost:8080/whats-new-in-jee8/rest/planetearth")
.request()
.accept(MediaType.TEXT_PLAIN)
.rx()
.get(String.class)
.exceptionally(e -> "the ultimate question of life, the universe, and everything");
New and noteworthy in JAX-RS 2.1
SSE support
What's new and noteworthy in Java EE 8? 16gedoplan.de
@Path("sse")
public class SseResource {
@Context Sse sse;
SseBroadcaster sseBroadcaster;
@PostConstruct
void init() {
this.sseBroadcaster = this.sse.newBroadcaster();
}
@GET
@Produces(MediaType.SERVER_SENT_EVENTS)
public void register(@Context SseEventSink sseEventSink) {
this.sseBroadcaster.register(sseEventSink);
}
public void tick() {
this.sseBroadcaster.broadcast(this.sse.newEvent("Hello, it is " + new Date()));
}
New and noteworthy in JAX-RS 2.1
SSE support
What's new and noteworthy in Java EE 8? 17gedoplan.de
try (SseEventSource sseEventSource = SseEventSource
.target("http://localhost:8080/whats-new-in-jee8/rest/sse")
.build()) {
sseEventSource.register(e -> log.debug("Event received: " + e));
sseEventSource.open();
Odds and ends
JSON-P
JSON-Pointer
JSON-Patch
JSON-Big-Data
Java EE Security API
Authentication Mechanism
Identity Store
Security Context
What's new and noteworthy in Java EE 8? 18gedoplan.de
<TTFN>
 -  = 3 years, 5 months
Evolution or maintenance release?
Implementations
GlassFish 5.0 (big areas nonfunctional)
Payara 5.0.0 (still alpha)
Open Liberty (daily build)
What's new and noteworthy in Java EE 8? 19gedoplan.de
The future …
What's new and noteworthy in Java EE 8? 20gedoplan.de
More
gedoplan-it-consulting.de/expertenkreis-java
Slides
github.com/GEDOPLAN/whats-new-in-jee8
Demo project
www.gedoplan-it-training.de
Trainings in Berlin, Bielefeld, inhouse
www.gedoplan-it-consulting.de
Reviews, Coaching, …
Blog
 dirk.weil@gedoplan.de
@dirkweil
What's new and noteworthy in Java EE 8? 21gedoplan.de

Más contenido relacionado

La actualidad más candente

Laporan multi client
Laporan multi clientLaporan multi client
Laporan multi client
ichsanbarokah
 
Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6
Ray Ploski
 

La actualidad más candente (20)

Qtp test
Qtp testQtp test
Qtp test
 
OrientDB - The 2nd generation of (multi-model) NoSQL
OrientDB - The 2nd generation of  (multi-model) NoSQLOrientDB - The 2nd generation of  (multi-model) NoSQL
OrientDB - The 2nd generation of (multi-model) NoSQL
 
Synthesizing API Usage Examples
Synthesizing API Usage Examples Synthesizing API Usage Examples
Synthesizing API Usage Examples
 
Graphql, REST and Apollo
Graphql, REST and ApolloGraphql, REST and Apollo
Graphql, REST and Apollo
 
Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113
 
Kotlin is charming; The reasons Java engineers should start Kotlin.
Kotlin is charming; The reasons Java engineers should start Kotlin.Kotlin is charming; The reasons Java engineers should start Kotlin.
Kotlin is charming; The reasons Java engineers should start Kotlin.
 
Laporan multi client
Laporan multi clientLaporan multi client
Laporan multi client
 
Vaadin 7 Today and Tomorrow
Vaadin 7 Today and TomorrowVaadin 7 Today and Tomorrow
Vaadin 7 Today and Tomorrow
 
"Migrate large gwt applications - Lessons Learned" By Harald Pehl
"Migrate large gwt applications - Lessons Learned" By Harald Pehl"Migrate large gwt applications - Lessons Learned" By Harald Pehl
"Migrate large gwt applications - Lessons Learned" By Harald Pehl
 
Dependency Injection with CDI in 15 minutes
Dependency Injection with CDI in 15 minutesDependency Injection with CDI in 15 minutes
Dependency Injection with CDI in 15 minutes
 
Kotlin meets Gadsu
Kotlin meets GadsuKotlin meets Gadsu
Kotlin meets Gadsu
 
greenDAO
greenDAOgreenDAO
greenDAO
 
Kotlin 101 for Java Developers
Kotlin 101 for Java DevelopersKotlin 101 for Java Developers
Kotlin 101 for Java Developers
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189
 
Hidden rocks in Oracle ADF
Hidden rocks in Oracle ADFHidden rocks in Oracle ADF
Hidden rocks in Oracle ADF
 
droidparts
droidpartsdroidparts
droidparts
 
Angular 2 introduction
Angular 2 introductionAngular 2 introduction
Angular 2 introduction
 
Implementing CQRS and Event Sourcing with RavenDB
Implementing CQRS and Event Sourcing with RavenDBImplementing CQRS and Event Sourcing with RavenDB
Implementing CQRS and Event Sourcing with RavenDB
 
Better Code: Concurrency
Better Code: ConcurrencyBetter Code: Concurrency
Better Code: Concurrency
 
Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6Introduction to CDI and DI in Java EE 6
Introduction to CDI and DI in Java EE 6
 

Similar a What's new and noteworthy in Java EE 8?

JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter PilgrimJavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesJavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development Experiences
Peter Pilgrim
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
Sven Haiges
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
intelliyole
 

Similar a What's new and noteworthy in Java EE 8? (20)

Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolbox
 
Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015
 
Green dao
Green daoGreen dao
Green dao
 
JUG Berlin Brandenburg: What's new in Java EE 7?
JUG Berlin Brandenburg: What's new in Java EE 7?JUG Berlin Brandenburg: What's new in Java EE 7?
JUG Berlin Brandenburg: What's new in Java EE 7?
 
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter PilgrimJavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
 
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesJavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development Experiences
 
JDK1.7 features
JDK1.7 featuresJDK1.7 features
JDK1.7 features
 
MVC and Entity Framework
MVC and Entity FrameworkMVC and Entity Framework
MVC and Entity Framework
 
Ejb examples
Ejb examplesEjb examples
Ejb examples
 
Json generation
Json generationJson generation
Json generation
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
 
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 FallJavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
JavaOne報告会 Java SE/JavaFX 編 - JJUG CCC 2010 Fall
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
 
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
 
Play 2.0
Play 2.0Play 2.0
Play 2.0
 
EJB et WS (Montreal JUG - 12 mai 2011)
EJB et WS (Montreal JUG - 12 mai 2011)EJB et WS (Montreal JUG - 12 mai 2011)
EJB et WS (Montreal JUG - 12 mai 2011)
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 

Último

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Último (20)

tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 

What's new and noteworthy in Java EE 8?

  • 1. What's new and noteworthy in Java EE 8? Expertenkreis Java, 05.12.2017, GEDOPLAN Dirk Weil, GEDOPLAN GmbH
  • 2. Dirk Weil GEDOPLAN GmbH, Bielefeld GEDOPLAN IT Consulting Konzeption, Realisierung von IT-Lösungen GEDOPLAN IT Training Seminare in Berlin, Bielefeld, on-site Java EE seit 1998 Vorträge, Veröffentlichungen What's new and noteworthy in Java EE 8? 2gedoplan.de
  • 3. New and noteworthy in CDI 2.0 Observer ordering What's new and noteworthy in Java EE 8? 3gedoplan.de @ApplicationScoped public class EventObserver { void a(@Observes @Priority(Interceptor.Priority.APPLICATION + 1) DemoEvent e) { … } void b(@Observes @Priority(Interceptor.Priority.APPLICATION + 2) DemoEvent e) { … } @ApplicationScoped public class EventProducer { @Inject Event<DemoEvent> eventSource; public void fireSyncEvent() { this.eventSource.fire(new DemoEvent());
  • 4. New and noteworthy in CDI 2.0 Asynchronuous events What's new and noteworthy in Java EE 8? 4gedoplan.de @ApplicationScoped public class EventObserver { void x(@ObservesAsync DemoEvent e) { … } void y(@ObservesAsync DemoEvent e) { … } @ApplicationScoped public class EventProducer { @Inject Event<DemoEvent> eventSource; public void fireAsyncEvent() { CompletionStage<DemoEvent> completionStage = this.eventSource.fireAsync(new DemoEvent());
  • 5. New and noteworthy in CDI 2.0 SE container What's new and noteworthy in Java EE 8? 5gedoplan.de SeContainerInitializer seContainerInitializer = SeContainerInitializer.newInstance(); try (SeContainer container = seContainerInitializer.initialize()) { HelloWorldService helloWorldService = container.select(HelloWorldService.class).get(); this.log.debug(helloWorldService.getHelloWorld()); } <dependency> <groupId>org.jboss.weld.se</groupId> <artifactId>weld-se-shaded</artifactId> <version>3.0.2.Final</version> </dependency> <dependency> <groupId>org.apache.openwebbeans</groupId> <artifactId>openwebbeans-se</artifactId> <version>2.0.2</version> </dependency>
  • 6. New and noteworthy in CDI 2.0 Java 8 alignment Repeatable qualifier annotations Instance.stream() Various minor adjustments No context control in SE  What's new and noteworthy in Java EE 8? 6gedoplan.de
  • 7. New and noteworthy in Bean Validation 2.0 New constraints @Email, @NotEmpty, @NotBlank, @Positive, @PositiveOrZero, @Negative, @NegativeOrZero, @PastOrPresent, @FutureOrPresent Container element constraints Java 8 alignment Repeatable constraint annotations Support for Java 8 date and time types Support for Optional<T> What's new and noteworthy in Java EE 8? 7gedoplan.de List<@Positive @Max(6) Integer> marks; Optional<@Email String> getEmail() { … }
  • 8. New and noteworthy in JPA 2.2 Java 8 alignment Repeatable annotations Support for LocalDate, LocalDateTime, LocalTime, OffsetDateTime, OffsetTime Query.getResultStream() Allow CDI injections into AttributeConverter What's new and noteworthy in Java EE 8? 8gedoplan.de public class Employee { @AttributeOverride(name = "street", column = @Column(name = "HOME_STREET")) @AttributeOverride(name = "zipCode", column = @Column(name = "HOME_ZIPCODE")) @AttributeOverride(name = "city", column = @Column(name = "HOME_CITY")) private Address homeAddress; public class DocumentRepository { public Stream<Document> findAllAsStream() { return entityManager .createQuery("select x from Document x", Document.class) .getResultStream();
  • 9. New and noteworthy in JSF 2.3 Java Time Support in <f:convertDateTime> CDI integration Deprecate javax.faces.bean Allow injection of specific JSF artifacts (e.g. FacesContext) Support CDI injections into converters What's new and noteworthy in Java EE 8? 9gedoplan.de <h:outputText id="founded" value="#{countryPresenter.someCountry.founded}"> <f:convertDateTime type="localDate"/> </h:outputText> public class Country { private LocalDate founded; @FacesConverter(forClass = Country.class, managed = true) public class CountryConverter implements Converter<Country> { @Inject CountryRepository countryRepository;
  • 10. New and noteworthy in JSF 2.3 Websocket integration What's new and noteworthy in Java EE 8? 10gedoplan.de <f:websocket channel="ticker" onmessage="function(message) { document.getElementById('coolNewFeature').value=message; }" /> <h:inputText id="coolNewFeature" value="" size="25" readonly="true" /> public class TickerEndpoint { @Inject @Push(channel = "ticker") private PushContext channel; public void tick() { String message = … this.channel.send(message);
  • 11. New and noteworthy in JSF 2.3 Multi-field validation Use non-default bean validation group for one or more input fields Use <f:validateWholeBean> after input fields Enable feature in web.xml Works by validating a temporary copy Not working on GlassFish 5  Incredibly bloated  What's new and noteworthy in Java EE 8? 11gedoplan.de <h:inputText value="#{questionnaire.email}"> <f:validateBean validationGroups="InitialInput" /> </h:inputText> <h:inputText value="#{questionnaire.comment}"> <f:validateBean validationGroups="InitialInput" /> </h:inputText> <f:validateWholeBean value="#{questionnaire}" validationGroups="InitialInput" />
  • 12. New and noteworthy: JSON-B 1.0 Java – JSON binding Similar to JAXB Mapping annotations @JsonbVisibility @JsonbNillable @JsonbTransient @JsonbTypeAdapter @JsonbDateFormat @JsonbNumberFormat What's new and noteworthy in Java EE 8? 12gedoplan.de @JsonbNillable public class Country { private String id; private String name; @JsonbTypeAdapter(ContinentConverter.class) private Continent continent; @JsonbTransient private String dummy = "unused";
  • 13. New and noteworthy: JSON-B 1.0 (De)serialization API: JsonbBuilder, Jsonb Configuration: Class level annotations (@JsonbNillable, …) JsonbConfig What's new and noteworthy in Java EE 8? 13gedoplan.de Country country = … try (Jsonb jsonb = JsonbBuilder.create()) { String json = jsonb.toJson(country); … } String json = … try (Jsonb jsonb = JsonbBuilder.create()) { Country country = jsonb.fromJson(json, Country.class); … } JsonbConfig jsonbConfig = new JsonbConfig().withFormatting(true); Jsonb jsonb = JsonbBuilder.create(jsonbConfig);
  • 14. New and noteworthy in Servlet 4.0 HTTP/2 support Header compression Request multiplexing: Allow multiple parallel requests on same connection Server push: Send content probably needed in advance In general „behind the scenes“ What's new and noteworthy in Java EE 8? 14gedoplan.de protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { PushBuilder pushBuilder = req.newPushBuilder(); if (pushBuilder != null) { pushBuilder.path("/dummy.css").push(); } …
  • 15. New and noteworthy in JAX-RS 2.1 Reactive client support What's new and noteworthy in Java EE 8? 15gedoplan.de Client client= ClientBuilder.newClient(); CompletionStage<String> planetearthCompletionStage = client .path("http://localhost:8080/whats-new-in-jee8/rest/planetearth") .request() .accept(MediaType.TEXT_PLAIN) .rx() .get(String.class) .exceptionally(e -> "the ultimate question of life, the universe, and everything");
  • 16. New and noteworthy in JAX-RS 2.1 SSE support What's new and noteworthy in Java EE 8? 16gedoplan.de @Path("sse") public class SseResource { @Context Sse sse; SseBroadcaster sseBroadcaster; @PostConstruct void init() { this.sseBroadcaster = this.sse.newBroadcaster(); } @GET @Produces(MediaType.SERVER_SENT_EVENTS) public void register(@Context SseEventSink sseEventSink) { this.sseBroadcaster.register(sseEventSink); } public void tick() { this.sseBroadcaster.broadcast(this.sse.newEvent("Hello, it is " + new Date())); }
  • 17. New and noteworthy in JAX-RS 2.1 SSE support What's new and noteworthy in Java EE 8? 17gedoplan.de try (SseEventSource sseEventSource = SseEventSource .target("http://localhost:8080/whats-new-in-jee8/rest/sse") .build()) { sseEventSource.register(e -> log.debug("Event received: " + e)); sseEventSource.open();
  • 18. Odds and ends JSON-P JSON-Pointer JSON-Patch JSON-Big-Data Java EE Security API Authentication Mechanism Identity Store Security Context What's new and noteworthy in Java EE 8? 18gedoplan.de
  • 19. <TTFN>  -  = 3 years, 5 months Evolution or maintenance release? Implementations GlassFish 5.0 (big areas nonfunctional) Payara 5.0.0 (still alpha) Open Liberty (daily build) What's new and noteworthy in Java EE 8? 19gedoplan.de
  • 20. The future … What's new and noteworthy in Java EE 8? 20gedoplan.de
  • 21. More gedoplan-it-consulting.de/expertenkreis-java Slides github.com/GEDOPLAN/whats-new-in-jee8 Demo project www.gedoplan-it-training.de Trainings in Berlin, Bielefeld, inhouse www.gedoplan-it-consulting.de Reviews, Coaching, … Blog  dirk.weil@gedoplan.de @dirkweil What's new and noteworthy in Java EE 8? 21gedoplan.de