SlideShare a Scribd company logo
1 of 35
Download to read offline
Java EE8 on a Diet with
Payara Micro 5
Mert Çalışkan, Gaurav Gupta
JavaOne 2017
Mert Çalışkan
Payara Developer
Java EE / Spring Consultant
Author of PrimeFaces Cookbook
Author of Beginning Spring book
Part-time Lecturer
@mertcal
Gaurav Gupta
Payara Developer
NetBeans Dream Team
Jeddict Creator ( jeddict.github.io )
@jGauravGupta , @ImJeddict
React to the talk
Join at
slido.com
#PM5
Agenda
- What’s new with Java EE 8?
- The Almighty: Payara Micro 5
- Demo w/ Conference App
- Q&A
@mertcal
What’s new with Java EE 8?
Java EE 8 is released on Sep 06, 2017.
● JAX-RS 2.1 (Jersey 2.26)
● CDI 2.0 (Weld 3.0.0.Final)
● Bean Validation 2.0 (Hibernate Validator 6.0.2.Final)
● JSON-B (Yasson 1.0)
● JPA 2.2 (EclipseLink 2.7.0)
● Java Security API 1.0 (Soteria 1.0)
Checkout https://github.com/javaee-samples/javaee8-samples for details on the
examples
@mertcal
● Reactive Client API
● JSON-B support
● Server Sent Events (SSE)
JAX-RS 2.1 (JSR 370)
@mertcal
● With JAX-RS 2.0, we had asynchronous invoker approach as:
Client client = ClientBuilder.newClient();
WebTarget target = client.target("http://localhost:8080/service-url");
Invocation.Builder builder = target.request();
Future<MyClass> futureResult = builder.async().get(MyClass.class);
System.out.println(futureResult.get());
client.close();
JAX-RS 2.1
@mertcal
● Previous scenario can also be implemented with InvocationCallback<T>
but…
Client client = ClientBuilder. newClient();
WebTarget target = client.target( "http://localhost:8080/service-url");
Invocation.Builder builder = target.request();
builder.async().get( new InvocationCallback<MyClass>() {
@Override
public void completed(MyClass t) {}
@Override
public void failed(Throwable throwable) {}
});
JAX-RS 2.1
@mertcal
● Reactive Client API to the rescue.
Client client = ClientBuilder.newClient();
WebTarget target = client.target("http://localhost:8080/service-url");
Invocation.Builder builder = target.request();
CompletionStage<Response> response = builder.rx().get();
response.thenAcceptAsync(res -> {
MyClass t = res.readEntity(MyClass.class);
System.out.println(t);
});
JerseyCompletionStageRxInvoker
CompletionStage<Response>
JAX-RS 2.1
@mertcal
● 3rd Party Reactive Framework Support
○ RxJava
Client client = ClientBuilder.newClient().register(RxFlowableInvokerProvider.class);
WebTarget target = client.target("http://localhost:8080/service-url");
Invocation.Builder builder = target.request();
Flowable<Response> flowable = builder.rx(RxFlowableInvoker.class).get();
flowable.subscribe(res -> {
MyClass t = res.readEntity(MyClass.class);
System.out.println(t);
});
reactive invoker specialized
for io.reactivex.Flowable
JAX-RS 2.1
@mertcal
Client client = ClientBuilder.newClient().target("http://localhost:8080/service-url")
.request()
.get();
Client client = ClientBuilder.newClient().target("http://localhost:8080/service-url")
.request()
.async()
.get();
Client client = ClientBuilder.newClient().target("http://localhost:8080/service-url")
.request()
.rx()
.get();
JAX-RS 2.1
@mertcal
● Server Sent Events (SSE) is a mechanism that allows server to
asynchronously push data from the server to client once the client-server
connection is established by the client.
● It’s mostly like Long-Pooling but it’s not :) and it’s not WebSockets either.
● Implementations already provided it with JAX-RS 2.0 but there was no standard
API. With JAX-RS 2.1, API is created under javax.ws.rs.sse
JAX-RS 2.1
@mertcal
@Path("/temperature")
public class TemperatureResource {
private final OutboundSseEvent.Builder sseEventBuilder;
public TemperatureResource( @Context Sse sse) {
this.sseEventBuilder = sse.newEventBuilder();
}
@GET
@Path("/{city}")
@Produces(MediaType.SERVER_SENT_EVENTS)
public void getCurrentTemperatureStream( @Context SseEventSink eventSink) {
while (true) {
eventSink.send( sseEventBuilder.data(temperature)
.mediaType(MediaType. APPLICATION_JSON_TYPE).build());
Thread. sleep(1000);
}
}
}
"text/event-stream"
1
2
3
4
JAX-RS 2.1
@mertcal
CDI 2.0 (JSR 365)
- SE Support - It’s possible to use CDI outside of Java EE
- Ordering of CDI events - @Priority helps ordering observers
void receive(@Observes @Priority(APPLICATION + 200) String greet) {
this.greet += greet + "2";
}
void receive2(@Observes @Priority(APPLICATION) String greet) {
this.greet = greet + "1";
}
For send(“Welcome”) output will be:
Welcome1Welcome2
@Inject
private Event<String> event;
public void send(String message) {
event.fire(message);
}
@mertcal
CompletableStage<MyEvent> eventSent = event.fireAsync( new MyEvent(),
NotificationOptions.ofExecutor(executor));
- Exception in async observer doesn’t break the observer invocation chain.
callMe(@Observes payload) callMe(@ObservesAsync payload)
event.fire(payload) Sync call Not Notified
event.fireAsync(payload) Not Notified Async call
- Long awaited Asynchronous Events Support
- Fire Sync → Observer Sync / Fire Async → Observer Async
CDI 2.0
@mertcal
● Java 8 Date and Time API Support
@Past(message = "must be a past date")
private java.time.Year yearOfBirth;
● Type Annotations
private List<@NotNull @Email String> emails;
private String @NotNull @Email[] emails;
private Map<@Valid Employee, @Valid Address> addressMap = new HashMap<>();
@mertcal
Bean Validation 2 (JSR 380)
● java.util.Optional Support
private Optional<@Past LocalDate> marriageAnniversary;
private Optional<@Size(max = 20) String> name;
● Repeating Annotations
@Max(value = 2000, groups = Default.class)
@Max(value = 5000, groups = GoldCustomer.class)
private long withdrawalAmount;
@mertcal
Bean Validation 2
Bean Validation 2
● Introduces new constraints
○ @Email
○ @NotBlank
○ @NotEmpty
○ @PastOrPresent
○ @FutureOrPresent
○ @Negative
○ @NegativeOrZero
○ @Positive
○ @PositiveOrZero
@mertcal
JSON-B (JSR 367)
● Standard solution like JAXB
● Default mapping between classes and JSON
● Customizable
a. Compile time
■ Property naming @JsonbProperty
■ Property ignoring @JsonbTransient
■ Null handling @JsonbNillable
■ Property ordering @JsonbPropertyOrder
■ Date and Number Format @JsonbDateFormat/@JsonbNumberFormat
■ Adapter @JsonbTypeAdapter
b. Runtime configration
■ Configuration builder JsonbConfig
@jGauravGupta
JSON-B - Customizations
class Speaker {
private String name;
private String pin;
private String email;
}
{
"name": "Gaurav",
"pin": "J1-Secret",
"email": "gaurav.gupta@payara.fish",
}
@jGauravGupta
JSON-B - Customizations
@JsonbPropertyOrder({"email", "name"})
class Speaker {
@JsonbProperty("speakerName")
private String name;
@JsonbTransient
private String pin;
private String email;
}
{
"email": "gaurav.gupta@payara.fish",
"speakerName": "Gaurav"
}
@jGauravGupta
JPA 2.2 (JSR 338)
● @Repeatable annotations
● Support Java 8 Date and Time API
● Ability to return stream of query result
● CDI Injection in AttributeConverters
@jGauravGupta
JPA 2.1
Container annotation required
@Entity
@NamedQueries({
@NamedQuery(name = "Speaker.findAll",
query = "SELECT s FROM Speaker s"),
@NamedQuery(name = "Speaker.findByName",
query = "SELECT s FROM Speaker s WHERE s.name = :name")
})
class Speaker {
@Convert(converter=LocalDateConverter.class)
private LocalDate dateOfBirth;
}
@jGauravGupta
AttributeConverter
implementation
JPA 2.2
Container annotation not required
@Entity
@NamedQueries({
@NamedQuery(name = "Speaker.findAll",
query = "SELECT s FROM Speaker s"),
@NamedQuery(name = "Speaker.findByName",
query = "SELECT s FROM Speaker s WHERE s.name = :name")
})
class Speaker {
@Convert(converter=LocalDateConverter.class)
private LocalDate dateOfBirth;
}
AttributeConverter not required @jGauravGupta
JPA 2.2
@Entity
@NamedQuery(name = "Speaker.findAll",
query = "SELECT s FROM Speaker s")
@NamedQuery(name = "Speaker.findByName",
query = "SELECT s FROM Speaker s WHERE s.name = :name")
class Speaker {
private LocalDate dateOfBirth;
}
@jGauravGupta
JPA 2.2
● Stream query results
Stream<Speaker> speakers =
em.createQuery(“SELECT s FROM Speaker”, Speaker.class)
.getResultStream();
@jGauravGupta
Security API 1.0 (JSR 375)
● Simplify the existing solution
● Enhance the portability
● New APIs
○ HTTPAuthenticationMechanism
○ IdentityStore
○ SecurityContext
@jGauravGupta
Security API 1.0 (JSR 375)
● Authentication Mechanism
○ validateRequest(request, response, httpMessageContext)
○ secureResponse(request, response, httpMessageContext)
○ cleanSubject(request, response, httpMessageContext)
● Identity Store
○ validate(credential)
○ getCallerGroups(credentialValidationResult)
● Security Context
○ getCallerPrincipal()
○ isCallerInRole(role)
○ … … …
@jGauravGupta
@ApplicationScoped
public class MyAuthMechanism implements HttpAuthenticationMechanism {
@Override
public AuthenticationStatus validateRequest(HttpServletRequest request,
HttpServletResponse response, HttpMessageContext context) {
}
}
Security API 1.0
@jGauravGupta
@ApplicationScoped
public class MyAuthMechanism implements HttpAuthenticationMechanism {
@Inject
private IdentityStoreHandler identityStoreHandler;
@Override
public AuthenticationStatus validateRequest(HttpServletRequest request,
HttpServletResponse response, HttpMessageContext context) {
………
identityStoreHandler.validate(credential);
………
}
}
Security API 1.0
@jGauravGupta
@ApplicationScoped
public class MyAuthMechanism implements HttpAuthenticationMechanism {
@Inject
private IdentityStoreHandler identityStoreHandler;
@Override
public AuthenticationStatus validateRequest (HttpServletRequest request,
HttpServletResponse response, HttpMessageContext context) {
………
identityStoreHandler.validate(credential);
………
}
}
Security API 1.0
@jGauravGupta
● Application Server as Executable JAR
○ Small: ~70mb
● Deploy WAR files directly from command line
● Contains Java EE8 specification on board such as:
○ JAX-RS 2.1
○ Bean Validation 2.0
○ CDI 2.0
○ JPA 2.2
@mertcal
Payara Micro 5
● Supports Automatic Clustering out of the box
○ Integrates with Hazelcast
○ Session replication with distributed caching
● JCA based Cloud Connectors
○ Amazon SQS
○ Kafka
○ MQTT
○ Azure Service Bus
● Eclipse MicroProfile Support w/ Config API
Payara Micro 5
@mertcal
Conference App - Blending All Together w/
jeddict.github.io
@Email
@JsonbProperty
("speakerName")
@JsonbTransient
java.time.LocalDate
@NamedQuery(name = "findAll")
@NamedQuery(name = "findByName")
@NamedQuery(name = "findByEmail")
@JsonbProperty
("detail")
@NotEmpty
Thank you!
Any
Questions?
%50 on ebook - JE8MEK50
%15 on printed - JE8MPK15
valid until October 11

More Related Content

What's hot

Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stackTomáš Kypta
 
Clustering your Application with Hazelcast
Clustering your Application with HazelcastClustering your Application with Hazelcast
Clustering your Application with HazelcastHazelcast
 
Apache Struts 2 Advance
Apache Struts 2 AdvanceApache Struts 2 Advance
Apache Struts 2 AdvanceEmprovise
 
Windows 8 Training Fundamental - 1
Windows 8 Training Fundamental - 1Windows 8 Training Fundamental - 1
Windows 8 Training Fundamental - 1Kevin Octavian
 
Architecture Components
Architecture Components Architecture Components
Architecture Components DataArt
 
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?gedoplan
 
Easy Scaling with Open Source Data Structures, by Talip Ozturk
Easy Scaling with Open Source Data Structures, by Talip OzturkEasy Scaling with Open Source Data Structures, by Talip Ozturk
Easy Scaling with Open Source Data Structures, by Talip OzturkZeroTurnaround
 
Advanced Hibernate V2
Advanced Hibernate V2Advanced Hibernate V2
Advanced Hibernate V2Haitham Raik
 
Advanced Hibernate
Advanced HibernateAdvanced Hibernate
Advanced HibernateHaitham Raik
 
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingBDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingJohn Ferguson Smart Limited
 
Whats New for WPF in .NET 4.5
Whats New for WPF in .NET 4.5Whats New for WPF in .NET 4.5
Whats New for WPF in .NET 4.5Rainer Stropek
 
Introduction to Restkit
Introduction to RestkitIntroduction to Restkit
Introduction to Restkitpetertmarks
 
Apache Struts 2 Framework
Apache Struts 2 FrameworkApache Struts 2 Framework
Apache Struts 2 FrameworkEmprovise
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Paco de la Cruz
 

What's hot (19)

Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stack
 
Clustering your Application with Hazelcast
Clustering your Application with HazelcastClustering your Application with Hazelcast
Clustering your Application with Hazelcast
 
Apache Struts 2 Advance
Apache Struts 2 AdvanceApache Struts 2 Advance
Apache Struts 2 Advance
 
Drools rule Concepts
Drools rule ConceptsDrools rule Concepts
Drools rule Concepts
 
Windows 8 Training Fundamental - 1
Windows 8 Training Fundamental - 1Windows 8 Training Fundamental - 1
Windows 8 Training Fundamental - 1
 
Architecture Components
Architecture Components Architecture Components
Architecture Components
 
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?
 
Easy Scaling with Open Source Data Structures, by Talip Ozturk
Easy Scaling with Open Source Data Structures, by Talip OzturkEasy Scaling with Open Source Data Structures, by Talip Ozturk
Easy Scaling with Open Source Data Structures, by Talip Ozturk
 
Advanced Hibernate V2
Advanced Hibernate V2Advanced Hibernate V2
Advanced Hibernate V2
 
Presentation cs313 (1)
Presentation cs313 (1)Presentation cs313 (1)
Presentation cs313 (1)
 
Lesson3
Lesson3Lesson3
Lesson3
 
Advanced Hibernate
Advanced HibernateAdvanced Hibernate
Advanced Hibernate
 
TY.BSc.IT Java QB U2
TY.BSc.IT Java QB U2TY.BSc.IT Java QB U2
TY.BSc.IT Java QB U2
 
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingBDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
 
Whats New for WPF in .NET 4.5
Whats New for WPF in .NET 4.5Whats New for WPF in .NET 4.5
Whats New for WPF in .NET 4.5
 
Introduction to Restkit
Introduction to RestkitIntroduction to Restkit
Introduction to Restkit
 
Apache Struts 2 Framework
Apache Struts 2 FrameworkApache Struts 2 Framework
Apache Struts 2 Framework
 
Struts2
Struts2Struts2
Struts2
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)
 

Similar to JavaEE 8 on a diet with Payara Micro 5

50 new features of Java EE 7 in 50 minutes
50 new features of Java EE 7 in 50 minutes50 new features of Java EE 7 in 50 minutes
50 new features of Java EE 7 in 50 minutesAntonio Goncalves
 
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)Red Hat Developers
 
Slice: OpenJPA for Distributed Persistence
Slice: OpenJPA for Distributed PersistenceSlice: OpenJPA for Distributed Persistence
Slice: OpenJPA for Distributed PersistencePinaki Poddar
 
Fifty New Features of Java EE 7 in Fifty Minutes
Fifty New Features of Java EE 7 in Fifty MinutesFifty New Features of Java EE 7 in Fifty Minutes
Fifty New Features of Java EE 7 in Fifty MinutesArun Gupta
 
Fifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 MinutesFifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 Minutesglassfish
 
Annotation processing and code gen
Annotation processing and code genAnnotation processing and code gen
Annotation processing and code genkoji lin
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolboxShem Magnezi
 
Core2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdfCore2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdfThchTrngGia
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamImre Nagi
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevMattias Karlsson
 
Vaadin with Java EE 7
Vaadin with Java EE 7Vaadin with Java EE 7
Vaadin with Java EE 7Peter Lehto
 
Sqladria 2009 SRC
Sqladria 2009 SRCSqladria 2009 SRC
Sqladria 2009 SRCtepsum
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)Markus Eisele
 
Java EE 7 - New Features and the WebSocket API
Java EE 7 - New Features and the WebSocket APIJava EE 7 - New Features and the WebSocket API
Java EE 7 - New Features and the WebSocket APIMarcus Schiesser
 
Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016takezoe
 

Similar to JavaEE 8 on a diet with Payara Micro 5 (20)

50 new features of Java EE 7 in 50 minutes
50 new features of Java EE 7 in 50 minutes50 new features of Java EE 7 in 50 minutes
50 new features of Java EE 7 in 50 minutes
 
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)
 
Struts2 notes
Struts2 notesStruts2 notes
Struts2 notes
 
Java EE 8
Java EE 8Java EE 8
Java EE 8
 
Slice: OpenJPA for Distributed Persistence
Slice: OpenJPA for Distributed PersistenceSlice: OpenJPA for Distributed Persistence
Slice: OpenJPA for Distributed Persistence
 
Fifty New Features of Java EE 7 in Fifty Minutes
Fifty New Features of Java EE 7 in Fifty MinutesFifty New Features of Java EE 7 in Fifty Minutes
Fifty New Features of Java EE 7 in Fifty Minutes
 
Fifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 MinutesFifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 Minutes
 
Spring data requery
Spring data requerySpring data requery
Spring data requery
 
Annotation processing and code gen
Annotation processing and code genAnnotation processing and code gen
Annotation processing and code gen
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolbox
 
Core2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdfCore2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdf
 
Requery overview
Requery overviewRequery overview
Requery overview
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Vaadin with Java EE 7
Vaadin with Java EE 7Vaadin with Java EE 7
Vaadin with Java EE 7
 
Sqladria 2009 SRC
Sqladria 2009 SRCSqladria 2009 SRC
Sqladria 2009 SRC
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)
 
Java EE 7 - New Features and the WebSocket API
Java EE 7 - New Features and the WebSocket APIJava EE 7 - New Features and the WebSocket API
Java EE 7 - New Features and the WebSocket API
 
Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016
 

More from Payara

Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​Payara
 
Payara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptxPayara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptxPayara
 
Jakarta Concurrency: Present and Future
Jakarta Concurrency: Present and FutureJakarta Concurrency: Present and Future
Jakarta Concurrency: Present and FuturePayara
 
GlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptxGlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptxPayara
 
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...Payara
 
Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2Payara
 
Reactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learnReactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learnPayara
 
Effective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfileEffective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfilePayara
 
A step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice designA step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice designPayara
 
Transactions in Microservices
Transactions in MicroservicesTransactions in Microservices
Transactions in MicroservicesPayara
 
Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5Payara
 
What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)Payara
 
Previewing Payara Platform 5.192
Previewing Payara Platform 5.192Previewing Payara Platform 5.192
Previewing Payara Platform 5.192Payara
 
Secure JAX-RS
Secure JAX-RSSecure JAX-RS
Secure JAX-RSPayara
 
Gradual Migration to MicroProfile
Gradual Migration to MicroProfileGradual Migration to MicroProfile
Gradual Migration to MicroProfilePayara
 
Monitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsMonitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsPayara
 
Java2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stackJava2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stackPayara
 
Java2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_appsJava2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_appsPayara
 
Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS] Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS] Payara
 
Ondrej mihalyi be reactive and micro with a micro profile stack
Ondrej mihalyi   be reactive and micro with a micro profile stackOndrej mihalyi   be reactive and micro with a micro profile stack
Ondrej mihalyi be reactive and micro with a micro profile stackPayara
 

More from Payara (20)

Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​
 
Payara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptxPayara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptx
 
Jakarta Concurrency: Present and Future
Jakarta Concurrency: Present and FutureJakarta Concurrency: Present and Future
Jakarta Concurrency: Present and Future
 
GlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptxGlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptx
 
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
 
Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2
 
Reactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learnReactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learn
 
Effective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfileEffective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfile
 
A step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice designA step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice design
 
Transactions in Microservices
Transactions in MicroservicesTransactions in Microservices
Transactions in Microservices
 
Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5
 
What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)
 
Previewing Payara Platform 5.192
Previewing Payara Platform 5.192Previewing Payara Platform 5.192
Previewing Payara Platform 5.192
 
Secure JAX-RS
Secure JAX-RSSecure JAX-RS
Secure JAX-RS
 
Gradual Migration to MicroProfile
Gradual Migration to MicroProfileGradual Migration to MicroProfile
Gradual Migration to MicroProfile
 
Monitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsMonitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile Metrics
 
Java2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stackJava2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stack
 
Java2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_appsJava2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_apps
 
Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS] Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS]
 
Ondrej mihalyi be reactive and micro with a micro profile stack
Ondrej mihalyi   be reactive and micro with a micro profile stackOndrej mihalyi   be reactive and micro with a micro profile stack
Ondrej mihalyi be reactive and micro with a micro profile stack
 

Recently uploaded

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 

Recently uploaded (20)

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 

JavaEE 8 on a diet with Payara Micro 5

  • 1. Java EE8 on a Diet with Payara Micro 5 Mert Çalışkan, Gaurav Gupta JavaOne 2017
  • 2. Mert Çalışkan Payara Developer Java EE / Spring Consultant Author of PrimeFaces Cookbook Author of Beginning Spring book Part-time Lecturer @mertcal Gaurav Gupta Payara Developer NetBeans Dream Team Jeddict Creator ( jeddict.github.io ) @jGauravGupta , @ImJeddict
  • 3. React to the talk Join at slido.com #PM5
  • 4. Agenda - What’s new with Java EE 8? - The Almighty: Payara Micro 5 - Demo w/ Conference App - Q&A @mertcal
  • 5. What’s new with Java EE 8? Java EE 8 is released on Sep 06, 2017. ● JAX-RS 2.1 (Jersey 2.26) ● CDI 2.0 (Weld 3.0.0.Final) ● Bean Validation 2.0 (Hibernate Validator 6.0.2.Final) ● JSON-B (Yasson 1.0) ● JPA 2.2 (EclipseLink 2.7.0) ● Java Security API 1.0 (Soteria 1.0) Checkout https://github.com/javaee-samples/javaee8-samples for details on the examples @mertcal
  • 6. ● Reactive Client API ● JSON-B support ● Server Sent Events (SSE) JAX-RS 2.1 (JSR 370) @mertcal
  • 7. ● With JAX-RS 2.0, we had asynchronous invoker approach as: Client client = ClientBuilder.newClient(); WebTarget target = client.target("http://localhost:8080/service-url"); Invocation.Builder builder = target.request(); Future<MyClass> futureResult = builder.async().get(MyClass.class); System.out.println(futureResult.get()); client.close(); JAX-RS 2.1 @mertcal
  • 8. ● Previous scenario can also be implemented with InvocationCallback<T> but… Client client = ClientBuilder. newClient(); WebTarget target = client.target( "http://localhost:8080/service-url"); Invocation.Builder builder = target.request(); builder.async().get( new InvocationCallback<MyClass>() { @Override public void completed(MyClass t) {} @Override public void failed(Throwable throwable) {} }); JAX-RS 2.1 @mertcal
  • 9. ● Reactive Client API to the rescue. Client client = ClientBuilder.newClient(); WebTarget target = client.target("http://localhost:8080/service-url"); Invocation.Builder builder = target.request(); CompletionStage<Response> response = builder.rx().get(); response.thenAcceptAsync(res -> { MyClass t = res.readEntity(MyClass.class); System.out.println(t); }); JerseyCompletionStageRxInvoker CompletionStage<Response> JAX-RS 2.1 @mertcal
  • 10. ● 3rd Party Reactive Framework Support ○ RxJava Client client = ClientBuilder.newClient().register(RxFlowableInvokerProvider.class); WebTarget target = client.target("http://localhost:8080/service-url"); Invocation.Builder builder = target.request(); Flowable<Response> flowable = builder.rx(RxFlowableInvoker.class).get(); flowable.subscribe(res -> { MyClass t = res.readEntity(MyClass.class); System.out.println(t); }); reactive invoker specialized for io.reactivex.Flowable JAX-RS 2.1 @mertcal
  • 11. Client client = ClientBuilder.newClient().target("http://localhost:8080/service-url") .request() .get(); Client client = ClientBuilder.newClient().target("http://localhost:8080/service-url") .request() .async() .get(); Client client = ClientBuilder.newClient().target("http://localhost:8080/service-url") .request() .rx() .get(); JAX-RS 2.1 @mertcal
  • 12. ● Server Sent Events (SSE) is a mechanism that allows server to asynchronously push data from the server to client once the client-server connection is established by the client. ● It’s mostly like Long-Pooling but it’s not :) and it’s not WebSockets either. ● Implementations already provided it with JAX-RS 2.0 but there was no standard API. With JAX-RS 2.1, API is created under javax.ws.rs.sse JAX-RS 2.1 @mertcal
  • 13. @Path("/temperature") public class TemperatureResource { private final OutboundSseEvent.Builder sseEventBuilder; public TemperatureResource( @Context Sse sse) { this.sseEventBuilder = sse.newEventBuilder(); } @GET @Path("/{city}") @Produces(MediaType.SERVER_SENT_EVENTS) public void getCurrentTemperatureStream( @Context SseEventSink eventSink) { while (true) { eventSink.send( sseEventBuilder.data(temperature) .mediaType(MediaType. APPLICATION_JSON_TYPE).build()); Thread. sleep(1000); } } } "text/event-stream" 1 2 3 4 JAX-RS 2.1 @mertcal
  • 14. CDI 2.0 (JSR 365) - SE Support - It’s possible to use CDI outside of Java EE - Ordering of CDI events - @Priority helps ordering observers void receive(@Observes @Priority(APPLICATION + 200) String greet) { this.greet += greet + "2"; } void receive2(@Observes @Priority(APPLICATION) String greet) { this.greet = greet + "1"; } For send(“Welcome”) output will be: Welcome1Welcome2 @Inject private Event<String> event; public void send(String message) { event.fire(message); } @mertcal
  • 15. CompletableStage<MyEvent> eventSent = event.fireAsync( new MyEvent(), NotificationOptions.ofExecutor(executor)); - Exception in async observer doesn’t break the observer invocation chain. callMe(@Observes payload) callMe(@ObservesAsync payload) event.fire(payload) Sync call Not Notified event.fireAsync(payload) Not Notified Async call - Long awaited Asynchronous Events Support - Fire Sync → Observer Sync / Fire Async → Observer Async CDI 2.0 @mertcal
  • 16. ● Java 8 Date and Time API Support @Past(message = "must be a past date") private java.time.Year yearOfBirth; ● Type Annotations private List<@NotNull @Email String> emails; private String @NotNull @Email[] emails; private Map<@Valid Employee, @Valid Address> addressMap = new HashMap<>(); @mertcal Bean Validation 2 (JSR 380)
  • 17. ● java.util.Optional Support private Optional<@Past LocalDate> marriageAnniversary; private Optional<@Size(max = 20) String> name; ● Repeating Annotations @Max(value = 2000, groups = Default.class) @Max(value = 5000, groups = GoldCustomer.class) private long withdrawalAmount; @mertcal Bean Validation 2
  • 18. Bean Validation 2 ● Introduces new constraints ○ @Email ○ @NotBlank ○ @NotEmpty ○ @PastOrPresent ○ @FutureOrPresent ○ @Negative ○ @NegativeOrZero ○ @Positive ○ @PositiveOrZero @mertcal
  • 19. JSON-B (JSR 367) ● Standard solution like JAXB ● Default mapping between classes and JSON ● Customizable a. Compile time ■ Property naming @JsonbProperty ■ Property ignoring @JsonbTransient ■ Null handling @JsonbNillable ■ Property ordering @JsonbPropertyOrder ■ Date and Number Format @JsonbDateFormat/@JsonbNumberFormat ■ Adapter @JsonbTypeAdapter b. Runtime configration ■ Configuration builder JsonbConfig @jGauravGupta
  • 20. JSON-B - Customizations class Speaker { private String name; private String pin; private String email; } { "name": "Gaurav", "pin": "J1-Secret", "email": "gaurav.gupta@payara.fish", } @jGauravGupta
  • 21. JSON-B - Customizations @JsonbPropertyOrder({"email", "name"}) class Speaker { @JsonbProperty("speakerName") private String name; @JsonbTransient private String pin; private String email; } { "email": "gaurav.gupta@payara.fish", "speakerName": "Gaurav" } @jGauravGupta
  • 22. JPA 2.2 (JSR 338) ● @Repeatable annotations ● Support Java 8 Date and Time API ● Ability to return stream of query result ● CDI Injection in AttributeConverters @jGauravGupta
  • 23. JPA 2.1 Container annotation required @Entity @NamedQueries({ @NamedQuery(name = "Speaker.findAll", query = "SELECT s FROM Speaker s"), @NamedQuery(name = "Speaker.findByName", query = "SELECT s FROM Speaker s WHERE s.name = :name") }) class Speaker { @Convert(converter=LocalDateConverter.class) private LocalDate dateOfBirth; } @jGauravGupta AttributeConverter implementation
  • 24. JPA 2.2 Container annotation not required @Entity @NamedQueries({ @NamedQuery(name = "Speaker.findAll", query = "SELECT s FROM Speaker s"), @NamedQuery(name = "Speaker.findByName", query = "SELECT s FROM Speaker s WHERE s.name = :name") }) class Speaker { @Convert(converter=LocalDateConverter.class) private LocalDate dateOfBirth; } AttributeConverter not required @jGauravGupta
  • 25. JPA 2.2 @Entity @NamedQuery(name = "Speaker.findAll", query = "SELECT s FROM Speaker s") @NamedQuery(name = "Speaker.findByName", query = "SELECT s FROM Speaker s WHERE s.name = :name") class Speaker { private LocalDate dateOfBirth; } @jGauravGupta
  • 26. JPA 2.2 ● Stream query results Stream<Speaker> speakers = em.createQuery(“SELECT s FROM Speaker”, Speaker.class) .getResultStream(); @jGauravGupta
  • 27. Security API 1.0 (JSR 375) ● Simplify the existing solution ● Enhance the portability ● New APIs ○ HTTPAuthenticationMechanism ○ IdentityStore ○ SecurityContext @jGauravGupta
  • 28. Security API 1.0 (JSR 375) ● Authentication Mechanism ○ validateRequest(request, response, httpMessageContext) ○ secureResponse(request, response, httpMessageContext) ○ cleanSubject(request, response, httpMessageContext) ● Identity Store ○ validate(credential) ○ getCallerGroups(credentialValidationResult) ● Security Context ○ getCallerPrincipal() ○ isCallerInRole(role) ○ … … … @jGauravGupta
  • 29. @ApplicationScoped public class MyAuthMechanism implements HttpAuthenticationMechanism { @Override public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, HttpMessageContext context) { } } Security API 1.0 @jGauravGupta
  • 30. @ApplicationScoped public class MyAuthMechanism implements HttpAuthenticationMechanism { @Inject private IdentityStoreHandler identityStoreHandler; @Override public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, HttpMessageContext context) { ……… identityStoreHandler.validate(credential); ……… } } Security API 1.0 @jGauravGupta
  • 31. @ApplicationScoped public class MyAuthMechanism implements HttpAuthenticationMechanism { @Inject private IdentityStoreHandler identityStoreHandler; @Override public AuthenticationStatus validateRequest (HttpServletRequest request, HttpServletResponse response, HttpMessageContext context) { ……… identityStoreHandler.validate(credential); ……… } } Security API 1.0 @jGauravGupta
  • 32. ● Application Server as Executable JAR ○ Small: ~70mb ● Deploy WAR files directly from command line ● Contains Java EE8 specification on board such as: ○ JAX-RS 2.1 ○ Bean Validation 2.0 ○ CDI 2.0 ○ JPA 2.2 @mertcal Payara Micro 5
  • 33. ● Supports Automatic Clustering out of the box ○ Integrates with Hazelcast ○ Session replication with distributed caching ● JCA based Cloud Connectors ○ Amazon SQS ○ Kafka ○ MQTT ○ Azure Service Bus ● Eclipse MicroProfile Support w/ Config API Payara Micro 5 @mertcal
  • 34. Conference App - Blending All Together w/ jeddict.github.io @Email @JsonbProperty ("speakerName") @JsonbTransient java.time.LocalDate @NamedQuery(name = "findAll") @NamedQuery(name = "findByName") @NamedQuery(name = "findByEmail") @JsonbProperty ("detail") @NotEmpty
  • 35. Thank you! Any Questions? %50 on ebook - JE8MEK50 %15 on printed - JE8MPK15 valid until October 11