SlideShare a Scribd company logo
Submit Search
Upload
EJB and CDI - Alignment and Strategy
Report
Share
David Delabassee
DevRel - Java Platform Group - Oracle
Follow
•
9 likes
•
31,883 views
1
of
43
EJB and CDI - Alignment and Strategy
•
9 likes
•
31,883 views
Report
Share
Download Now
Download to read offline
Internet
Presented by Linda DeMichiel Java Day Tokyo 2015 April 8, 2015
Read more
David Delabassee
DevRel - Java Platform Group - Oracle
Follow
Recommended
Introduction and Deep Dive Into Containerd by
Introduction and Deep Dive Into Containerd
Kohei Tokunaga
456 views
•
36 slides
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart... by
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
Jelastic Multi-Cloud PaaS
1.8K views
•
63 slides
Spring MVC 3.0 Framework by
Spring MVC 3.0 Framework
Ravi Kant Soni (ravikantsoni03@gmail.com)
6.3K views
•
24 slides
DECENTRALISED CHAT APPLICATION by
DECENTRALISED CHAT APPLICATION
IRJET Journal
63 views
•
5 slides
Second Level Cache in JPA Explained by
Second Level Cache in JPA Explained
Patrycja Wegrzynowicz
4.1K views
•
72 slides
Amazon EKS によるスマホゲームのバックエンド運用事例 by
Amazon EKS によるスマホゲームのバックエンド運用事例
gree_tech
7.6K views
•
43 slides
More Related Content
What's hot
Software update for IoT: the current state of play by
Software update for IoT: the current state of play
Chris Simmonds
4.7K views
•
27 slides
Async code on kotlin: rx java or/and coroutines - Kotlin Night Turin by
Async code on kotlin: rx java or/and coroutines - Kotlin Night Turin
Fabio Collini
901 views
•
42 slides
Code Factory avec GitLab CI et Rancher by
Code Factory avec GitLab CI et Rancher
SUSE
179 views
•
22 slides
Difference between Java and c# by
Difference between Java and c#
Sagar Pednekar
51.7K views
•
24 slides
Introduction to docker by
Introduction to docker
Hiroki Endo
2.9K views
•
36 slides
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control by
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Arjun Thakur
2.7K views
•
43 slides
What's hot
(20)
Software update for IoT: the current state of play by Chris Simmonds
Software update for IoT: the current state of play
Chris Simmonds
•
4.7K views
Async code on kotlin: rx java or/and coroutines - Kotlin Night Turin by Fabio Collini
Async code on kotlin: rx java or/and coroutines - Kotlin Night Turin
Fabio Collini
•
901 views
Code Factory avec GitLab CI et Rancher by SUSE
Code Factory avec GitLab CI et Rancher
SUSE
•
179 views
Difference between Java and c# by Sagar Pednekar
Difference between Java and c#
Sagar Pednekar
•
51.7K views
Introduction to docker by Hiroki Endo
Introduction to docker
Hiroki Endo
•
2.9K views
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control by Arjun Thakur
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Arjun Thakur
•
2.7K views
Fundamentals of JDBC by Jainul Musani
Fundamentals of JDBC
Jainul Musani
•
313 views
[KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui... by Akihiro Suda
[KubeConUS2019 Docker, Inc. Booth] Distributed Builds on Kubernetes with Bui...
Akihiro Suda
•
10K views
Zero-Copy Event-Driven Servers with Netty by Daniel Bimschas
Zero-Copy Event-Driven Servers with Netty
Daniel Bimschas
•
22.5K views
EKS vs GKE vs AKS - Evaluating Kubernetes in the Cloud by DevOps.com
EKS vs GKE vs AKS - Evaluating Kubernetes in the Cloud
DevOps.com
•
727 views
AWSのEC2の複数インスタンスからファイルを共有する方法 by 聡 大久保
AWSのEC2の複数インスタンスからファイルを共有する方法
聡 大久保
•
17.8K views
JNA - Let's C what it's worth by Idan Sheinberg
JNA - Let's C what it's worth
Idan Sheinberg
•
3K views
[社内勉強会]ELBとALBと数万スパイク負荷テスト by Takahiro Moteki
[社内勉強会]ELBとALBと数万スパイク負荷テスト
Takahiro Moteki
•
29.4K views
Introduction to Spring Framework by Serhat Can
Introduction to Spring Framework
Serhat Can
•
26K views
Containerd Internals: Building a Core Container Runtime by Phil Estes
Containerd Internals: Building a Core Container Runtime
Phil Estes
•
2.1K views
Docker, LinuX Container by Araf Karsh Hamid
Docker, LinuX Container
Araf Karsh Hamid
•
5.6K views
A guide of PostgreSQL on Kubernetes by t8kobayashi
A guide of PostgreSQL on Kubernetes
t8kobayashi
•
1.4K views
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203 by Linaro
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
Linaro
•
1.5K views
Project Orleans - Actor Model framework by Neil Mackenzie
Project Orleans - Actor Model framework
Neil Mackenzie
•
4.4K views
基幹業務もHadoopで!! -ローソンにおける店舗発注業務へのHadoop + Hive導入と その取り組みについて- by Keigo Suda
基幹業務もHadoopで!! -ローソンにおける店舗発注業務へのHadoop + Hive導入と その取り組みについて-
Keigo Suda
•
12.8K views
Viewers also liked
2015 JavaOne EJB/CDI Alignment by
2015 JavaOne EJB/CDI Alignment
David Blevins
30.7K views
•
31 slides
Servlet 4.0 at GeekOut 2015 by
Servlet 4.0 at GeekOut 2015
Edward Burns
19.3K views
•
87 slides
Top 50 java ee 7 best practices [con5669] by
Top 50 java ee 7 best practices [con5669]
Ryan Cuprak
9.3K views
•
78 slides
Dependency injection for beginners by
Dependency injection for beginners
Bhushan Mulmule
2.2K views
•
52 slides
Solaris 11 Consolidation Tools by
Solaris 11 Consolidation Tools
Roman Ivanov
5.4K views
•
35 slides
Oracle RAC 25年の進化 by
Oracle RAC 25年の進化
オラクルエンジニア通信
14.3K views
•
11 slides
Viewers also liked
(20)
2015 JavaOne EJB/CDI Alignment by David Blevins
2015 JavaOne EJB/CDI Alignment
David Blevins
•
30.7K views
Servlet 4.0 at GeekOut 2015 by Edward Burns
Servlet 4.0 at GeekOut 2015
Edward Burns
•
19.3K views
Top 50 java ee 7 best practices [con5669] by Ryan Cuprak
Top 50 java ee 7 best practices [con5669]
Ryan Cuprak
•
9.3K views
Dependency injection for beginners by Bhushan Mulmule
Dependency injection for beginners
Bhushan Mulmule
•
2.2K views
Solaris 11 Consolidation Tools by Roman Ivanov
Solaris 11 Consolidation Tools
Roman Ivanov
•
5.4K views
Oracle RAC 25年の進化 by オラクルエンジニア通信
Oracle RAC 25年の進化
オラクルエンジニア通信
•
14.3K views
Business Strategy & Alignment to Project Management by Jonathan Donado
Business Strategy & Alignment to Project Management
Jonathan Donado
•
11.5K views
Java EE 7: Developing for the Cloud at Geecon, JEEConf, Johannesburg by Arun Gupta
Java EE 7: Developing for the Cloud at Geecon, JEEConf, Johannesburg
Arun Gupta
•
6.3K views
Ejb3 Presentation by Saurabh Raisinghani
Ejb3 Presentation
Saurabh Raisinghani
•
2.9K views
Dependency injection - the right way by Thibaud Desodt
Dependency injection - the right way
Thibaud Desodt
•
23.1K views
Batching and Java EE (jdk.io) by Ryan Cuprak
Batching and Java EE (jdk.io)
Ryan Cuprak
•
2.1K views
JetBrains IDEハンズオン by Yusuke Yamamoto
JetBrains IDEハンズオン
Yusuke Yamamoto
•
1.3K views
Designing JEE Application Structure by odedns
Designing JEE Application Structure
odedns
•
10.7K views
EJB 3.1 by Bert Ertman by Stephan Janssen
EJB 3.1 by Bert Ertman
Stephan Janssen
•
4.3K views
Enterprise Java Beans 3 - Business Logic by Emprovise
Enterprise Java Beans 3 - Business Logic
Emprovise
•
1.6K views
Java EE 7 for Real Enterprise Systems by Hirofumi Iwasaki
Java EE 7 for Real Enterprise Systems
Hirofumi Iwasaki
•
2.3K views
Curso Java Avanzado 5 Ejb by Emilio Aviles Avila
Curso Java Avanzado 5 Ejb
Emilio Aviles Avila
•
7.5K views
Java ee 8 + security overview by Rudy De Busscher
Java ee 8 + security overview
Rudy De Busscher
•
3.7K views
Java EE Pattern: The Boundary Layer by Brockhaus Consulting GmbH
Java EE Pattern: The Boundary Layer
Brockhaus Consulting GmbH
•
2.6K views
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014) by Ryan Cuprak
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Ryan Cuprak
•
15.8K views
Similar to EJB and CDI - Alignment and Strategy
Java EE 6 Live Hacking - Java Developer Day 2012 by
Java EE 6 Live Hacking - Java Developer Day 2012
Martin Fousek
534 views
•
13 slides
MVC 1.0 / JSR 371 by
MVC 1.0 / JSR 371
David Delabassee
12.7K views
•
42 slides
JSF 2.3 Adopt-a-JSR 10 Minute Infodeck by
JSF 2.3 Adopt-a-JSR 10 Minute Infodeck
Edward Burns
3.6K views
•
22 slides
Oracle JET overview by
Oracle JET overview
Steven Davelaar
2.3K views
•
19 slides
Burns jsf-confess-2015 by
Burns jsf-confess-2015
Edward Burns
2.3K views
•
37 slides
How to Thrive on REST/WebSocket-Based Microservices by
How to Thrive on REST/WebSocket-Based Microservices
Pavel Bucek
1.2K views
•
42 slides
Similar to EJB and CDI - Alignment and Strategy
(20)
Java EE 6 Live Hacking - Java Developer Day 2012 by Martin Fousek
Java EE 6 Live Hacking - Java Developer Day 2012
Martin Fousek
•
534 views
MVC 1.0 / JSR 371 by David Delabassee
MVC 1.0 / JSR 371
David Delabassee
•
12.7K views
JSF 2.3 Adopt-a-JSR 10 Minute Infodeck by Edward Burns
JSF 2.3 Adopt-a-JSR 10 Minute Infodeck
Edward Burns
•
3.6K views
Oracle JET overview by Steven Davelaar
Oracle JET overview
Steven Davelaar
•
2.3K views
Burns jsf-confess-2015 by Edward Burns
Burns jsf-confess-2015
Edward Burns
•
2.3K views
How to Thrive on REST/WebSocket-Based Microservices by Pavel Bucek
How to Thrive on REST/WebSocket-Based Microservices
Pavel Bucek
•
1.2K views
JDK versions and OpenJDK by Wolfgang Weigend
JDK versions and OpenJDK
Wolfgang Weigend
•
1.8K views
JDK 10 Java Module System by Wolfgang Weigend
JDK 10 Java Module System
Wolfgang Weigend
•
3.1K views
Mastering DevOps with Oracle by jeckels
Mastering DevOps with Oracle
jeckels
•
17.7K views
JavaOne2015報告会 in Okinawa by Takashi Ito
JavaOne2015報告会 in Okinawa
Takashi Ito
•
745 views
Increased Developer Productivity for IoT with Java and Reactive Blocks (Oracl... by Bart Jonkers
Increased Developer Productivity for IoT with Java and Reactive Blocks (Oracl...
Bart Jonkers
•
554 views
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012 by Jagadish Prasath
EJB 3.2 - Java EE 7 - Java One Hyderabad 2012
Jagadish Prasath
•
1.6K views
Testing Java EE Applications Using Arquillian by Reza Rahman
Testing Java EE Applications Using Arquillian
Reza Rahman
•
25.7K views
Oracle WebLogic Server 12.2.1 Do More with Less by Ed Burns
Oracle WebLogic Server 12.2.1 Do More with Less
Ed Burns
•
1.5K views
Serverless Java - Challenges and Triumphs by David Delabassee
Serverless Java - Challenges and Triumphs
David Delabassee
•
282 views
Java SE Subscription Workshop by MarketingArrowECS_CZ
Java SE Subscription Workshop
MarketingArrowECS_CZ
•
1.6K views
Melhore o Desenvolvimento do Time com DevOps na Nuvem by Bruno Borges
Melhore o Desenvolvimento do Time com DevOps na Nuvem
Bruno Borges
•
3.9K views
Turning Relational Database Tables into Hadoop Datasources by Kuassi Mensah by Data Con LA
Turning Relational Database Tables into Hadoop Datasources by Kuassi Mensah
Data Con LA
•
282 views
Full Speed Ahead! (Ahead-of-Time Compilation for Java SE) [JavaOne 2017 CON3738] by David Buck
Full Speed Ahead! (Ahead-of-Time Compilation for Java SE) [JavaOne 2017 CON3738]
David Buck
•
429 views
OOW15 - Oracle Enterprise Manager Cloud Control for Managing Oracle E-Busines... by vasuballa
OOW15 - Oracle Enterprise Manager Cloud Control for Managing Oracle E-Busines...
vasuballa
•
1.4K views
More from David Delabassee
JVMs in Containers - Best Practices by
JVMs in Containers - Best Practices
David Delabassee
726 views
•
37 slides
JVMs in Containers by
JVMs in Containers
David Delabassee
1.3K views
•
38 slides
Serverless Java Challenges & Triumphs by
Serverless Java Challenges & Triumphs
David Delabassee
1.2K views
•
46 slides
Randstad Docker meetup - Serverless by
Randstad Docker meetup - Serverless
David Delabassee
322 views
•
37 slides
Java Serverless in Action - Voxxed Banff by
Java Serverless in Action - Voxxed Banff
David Delabassee
232 views
•
22 slides
Serverless Kotlin by
Serverless Kotlin
David Delabassee
251 views
•
24 slides
More from David Delabassee
(20)
JVMs in Containers - Best Practices by David Delabassee
JVMs in Containers - Best Practices
David Delabassee
•
726 views
JVMs in Containers by David Delabassee
JVMs in Containers
David Delabassee
•
1.3K views
Serverless Java Challenges & Triumphs by David Delabassee
Serverless Java Challenges & Triumphs
David Delabassee
•
1.2K views
Randstad Docker meetup - Serverless by David Delabassee
Randstad Docker meetup - Serverless
David Delabassee
•
322 views
Java Serverless in Action - Voxxed Banff by David Delabassee
Java Serverless in Action - Voxxed Banff
David Delabassee
•
232 views
Serverless Kotlin by David Delabassee
Serverless Kotlin
David Delabassee
•
251 views
REST in an Async World by David Delabassee
REST in an Async World
David Delabassee
•
2.3K views
JAX-RS 2.1 Reloaded by David Delabassee
JAX-RS 2.1 Reloaded
David Delabassee
•
1.7K views
Java EE 8 - February 2017 update by David Delabassee
Java EE 8 - February 2017 update
David Delabassee
•
6K views
Java EE Next by David Delabassee
Java EE Next
David Delabassee
•
2.2K views
Java EE Next - BeJUG JavaOne Afterglow 2016 by David Delabassee
Java EE Next - BeJUG JavaOne Afterglow 2016
David Delabassee
•
433 views
HTTP/2 comes to Java by David Delabassee
HTTP/2 comes to Java
David Delabassee
•
5.9K views
Java EE 8 - Work in progress by David Delabassee
Java EE 8 - Work in progress
David Delabassee
•
2.5K views
HTTP/2 comes to Java (Dec. 2015 version) by David Delabassee
HTTP/2 comes to Java (Dec. 2015 version)
David Delabassee
•
690 views
HTTP/2 Comes to Java by David Delabassee
HTTP/2 Comes to Java
David Delabassee
•
2.9K views
Java EE 8 - What’s new on the Web front by David Delabassee
Java EE 8 - What’s new on the Web front
David Delabassee
•
960 views
HTTP/2 Comes to Java by David Delabassee
HTTP/2 Comes to Java
David Delabassee
•
10.8K views
What's coming in Java EE 8 by David Delabassee
What's coming in Java EE 8
David Delabassee
•
2.3K views
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0 by David Delabassee
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
David Delabassee
•
1.8K views
Java EE 8 - An instant snapshot by David Delabassee
Java EE 8 - An instant snapshot
David Delabassee
•
10.7K views
Recently uploaded
ARNAB12.pdf by
ARNAB12.pdf
ArnabChakraborty499766
5 views
•
83 slides
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx by
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx
LeasedLinesQuote
5 views
•
8 slides
How to think like a threat actor for Kubernetes.pptx by
How to think like a threat actor for Kubernetes.pptx
LibbySchulze1
7 views
•
33 slides
Affiliate Marketing by
Affiliate Marketing
Navin Dhanuka
20 views
•
30 slides
WITS Deck by
WITS Deck
W.I.T.S.
18 views
•
22 slides
hamro digital logics.pptx by
hamro digital logics.pptx
tupeshghimire
11 views
•
36 slides
Recently uploaded
(10)
ARNAB12.pdf by ArnabChakraborty499766
ARNAB12.pdf
ArnabChakraborty499766
•
5 views
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx by LeasedLinesQuote
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx
LeasedLinesQuote
•
5 views
How to think like a threat actor for Kubernetes.pptx by LibbySchulze1
How to think like a threat actor for Kubernetes.pptx
LibbySchulze1
•
7 views
Affiliate Marketing by Navin Dhanuka
Affiliate Marketing
Navin Dhanuka
•
20 views
WITS Deck by W.I.T.S.
WITS Deck
W.I.T.S.
•
18 views
hamro digital logics.pptx by tupeshghimire
hamro digital logics.pptx
tupeshghimire
•
11 views
The Dark Web : Hidden Services by Anshu Singh
The Dark Web : Hidden Services
Anshu Singh
•
19 views
Amine el bouzalimi by Amine EL BOUZALIMI
Amine el bouzalimi
Amine EL BOUZALIMI
•
5 views
ATPMOUSE_융합2조.pptx by kts120898
ATPMOUSE_융합2조.pptx
kts120898
•
35 views
cis5-Project-11a-Harry Lai by harrylai126
cis5-Project-11a-Harry Lai
harrylai126
•
9 views
EJB and CDI - Alignment and Strategy
3.
EJB and CDI Alignment
and Strategy Linda DeMichiel Java EE Specification Lead Oracle Java Day Tokyo 2015 April 8, 2015 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
4.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 4
5.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Program Agenda EJB – History, Goals, Evolution CDI– History, Goals, Evolution Advantages/disadvantages – when to use EJB/CDI Java EE – Managed Bean Alignment What is our strategy for the future 1 2 3 4 5 5
6.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | EJB • EJB 1.0 (begun 1996) – Origins in TP monitors and component-based systems (e.g. Microsoft MTS) – Designed for remote access and coarse-grained components • EJB 1.1 (J2EE 1.2) – First "real" EJB • EJB 2.0 (J2EE 1.3) – Updated Entity Beans; EJB QL; Message-driven Beans; IIOP Interoperability • EJB 2.1 (J2EE 1.4) – Web services support; Timer service Some Background and History 6
7.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | EJB • EJB 3.0 (Java EE 5) – First "modern" EJB – Theme is "Ease of Development" – Annotations; resource injection; simple interfaces; Java Persistence API; interceptors • EJB 3.1 (Java EE 6) – No-interface view; asynchronous methods; singletons; EJB Lite; Embedded EJB – Interceptors separated into own spec; JPA separated into own JSR • EJB 3.2 (Java EE 7) – EJB Entity Beans and JAX-RPC now optional Some Background and History 7
8.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | EJB Today • EJBs are POJOs • Container provides services for ease-of-development – Injection – Transactions (declarative with defaults or programmatic) – Security (declarative with defaults or programmatic) – Thread management; synchronization; async support – Timed notifications (declarative or programmatic) – Integration with JMS, Web Services, IIOP-based clients and services 8
9.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Program Agenda EJB – History, Goals, Evolution CDI– History, Goals, Evolution Advantages/disadvantages – when to use EJB/CDI Java EE – Managed Bean Alignment What is our strategy for the future 1 2 3 4 5 9
10.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI • CDI 1.0 (Java EE 6) – Original goal: direct JSF and EJB integration – Dependency injection with typed injection points; typesafe resolution – Annotations, qualifiers, stereotypes for strong typing – Scopes, contexts for automatic bean lifecycle management – Producers – Interceptor bindings; decorators – Events and observers – Rich SPI for portable extensions Some Background and History 10
11.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI • CDI 1.1 (Java EE 7) – Implicit bean archives – Globally enabled interceptors, decorators, alternatives (with @Priority) – JTA transactional interceptors; @AroundConstruct interceptors – Enhancements to SPI and portable extensions Some Background and History 11
12.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI Today • Managed Bean POJOs are central – @Named qualifier allows direct use in JSF, EL, … • Container provides services – Type-safe injection – Lifecycle management; contexts; scopes; lifecycle callbacks – Event firing and delivery – Producers, Alternatives to configure available beans – Extensible model and rich SPI 12
13.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Program Agenda EJB – History, Goals, Evolution CDI– History, Goals, Evolution Advantages/disadvantages – when to use EJB/CDI Java EE – Managed Bean Alignment What is our strategy for the future 1 2 3 4 5 13
14.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI Advantages • Annotation-based programming model; stereotypes • Type-safe injection, interceptors, decorators • Context management, scopes, conversations • Events and observers • Producers and disposers • Extensibility – Custom scopes; programmatically defined beans; etc. Higher level of abstraction What does CDI give you that EJB alone does not? 14
15.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI Advantages • Automatic context and lifecycle management remove/pooling • Events+observers callbacks • Conversations • Metalevel programming / extensibility Higher level of abstraction vs EJB 15
16.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | EJB Advantages • Remote access – RMI / CORBA – Web Services • MDBs / JMS • Timers; scheduled events • Asynchronous methods • Security intergration • JPA integration; container-managed extended persistence context • Locking for concurrent access What does EJB give you that CDI does not? 16
17.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | EJB Advantages • EJBs (session beans) are CDI managed beans – They have all the benefits of CDI – Stateless session beans – @Dependent scope – Stateful session beans – any scope – Singleton session beans – @ApplicationScoped – However, need to use @Inject, not @EJB to acquire • Converse is not true – CDI beans are not EJBs – However: We are moving EJB benefits into CDI What else does EJB give you? 17
18.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Program Agenda EJB – History, Goals, Evolution CDI– History, Goals, Evolution Advantages/disadvantages – when to use EJB/CDI Java EE – Managed Bean Alignment What is our strategy for the future 1 2 3 4 5 18
19.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI and EJB: Bridging the Gap in Java EE • @ManagedBean • Managed Bean spec, introduced in Java EE 6 – Identified commonalities among different components as "managed beans" – Identified points for extension • "Managed Bean Alignment" was an important theme of Java EE 7 – Generalize use of injection, interceptors, new scopes 19
20.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Managed Beans – Java EE 6 20 MATRIX1 Java EE 6 Contextual Support CDI injection into them Support Java EE Resource injection into them Injectable with @Inject Injectable with @Resource, @EJB, … (EE- defined) Support CDI interceptors Support EE interceptors Support Decorators Support Observer methods Can fire events Support Producer methods Can have Qualifiers Can have Scope Support CDI Constructor injection Support Timers CDI managed beans (non-EJBs) Y Y Y Y Y Y Y(1) Y Y Y Y Y Y Y Session beans (CDI-enabled behavior via @Inject) Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Java EE @ManagedBean beans (CDI- enabled behavior via @Inject) Y Y Y Y Y Y Y Y Y Y Y Y Y Y Session beans obtained via @EJB or JNDI lookup (with CDI enabled) Y Y Y Y Y Y Java EE @ManagedBeans beans obtained via @Resource or JNDI lookup (with CDI enabled) Y Y Y Y Y MDBs Y Y Y Y Y JAX-RS Resource classes Y Y Y Servlets Y Y Y Servlet filters, listeners Y Y Y Other Java EE component classes (Table EE. 5-1) Y Y Y JPA entities JPA entity listeners Y(4) Y Interceptors Y Y Y Decorators Y Y Y Producer methods Y(3) Y(5) Y(5) Y Y (2)(3) Y(2) Producer fields Y(2) Y(2) Disposer methods Y(3) Y(5) Y(5) Y Y(3) Observer methods Y(3) Y(5) Y(5) Y Y(3)
21.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI and EJB: Bridging the Gap in Java EE 7 • CDI is enabled by default in "implicit bean archives" • Use of CDI bean-defining annotations results in implicit bean archives – @SessionScoped, @Dependent, … – Bean archives include library jars, EJB jars, WEB-INF classes, … – No beans.xml required Enabling CDI by Default 21
22.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI and EJB: Bridging the Gap in Java EE 7 • CDI injection applies to all Java EE components when CDI is enabled • Java EE components support resource injection + CDI injection – Support for constructor injection added as well • CDI beans support CDI injection + resource injection • CDI producers can "transform" resource injection into CDI injection, making it strongly typed @Produces @Resource(lookup="java:global/env/jdbc/CustomerDatasource") @CustomerDatabase DataSource customerDatabase; Injection 22
23.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI and EJB: Bridging the Gap in Java EE 7 • CDI interceptor-binding interceptors apply to all Java EE components when CDI is enabled • EJBs support "EJB interceptors" + CDI interceptor-binding interceptors • CDI beans support CDI interceptor-binding interceptors + "EJB interceptors" • Java EE components also support both Interceptors 23
24.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | JTA Transactional Interceptors @Inherited @InterceptorBinding @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface Transactional { TxType value() default TxType.REQUIRED; Class[] rollbackOn() default{}; Class[] dontRollbackOn() default{}; } @Transactional(rollbackOn={SQLException.class}, dontRollbackOn={SQLWarning.class}) public class ShoppingCart {...} Generalization of Container-managed Transactions (Java EE 7) 24
25.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Bean Validation Interceptors @Stateless public class OrderService { ... @ValidOrder public Order placeOrder( @NotNull String productName, @Max(10) int quantity, @NotNull String customerName, @Address String customerAddress) { ... } } Method-level Validation (Bean Validation 1.1, Java EE 7) 25
26.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI and EJB: Bridging the Gap in Java EE 7 • CDI Scopes are extensible – @TransactionScope • Defined in JTA 1.2 • Used by JMS 2.0 – @FlowScoped (JSF 2.2) – WebSocket expected to define scope for WebSocket endpoints in Java EE 8 Scopes 26
27.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Managed Beans – Java EE 7 27 MATRIX Java EE 7 Contextual Support CDI injection into them Support Java EE Resource injection into them Injectable with @Inject Injectable with @Resource, @EJB, … (EE- defined) Support CDI interceptors Support EE interceptors (1) Support Decorators Support Observer methods Can fire events Support Producer methods Can have Qualifiers Can have Scope Support CDI Constructor injection Support Timers CDI managed beans (non-EJBs) Y Y Y Y Y Y Y Y Y Y Y Y Y Y Session beans (CDI-enabled behavior via @Inject) Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Java EE @ManagedBean beans (CDI- enabled behavior via @Inject) Y Y Y Y Y Y Y Y Y Y Y Y Y Y Session beans obtained via @EJB or JNDI lookup (with CDI enabled) Y Y Y Y Y Y Y Y Y Java EE @ManagedBeans beans obtained via @Resource or JNDI lookup (with CDI enabled) Y Y Y Y Y Y Y Y MDBs Y Y Y(6) Y Y Y Y Y JAX-RS Resource classes Y Y Y(6) Y Y Y Y Y Servlets Y Y Y(6) Y Y Y Y Y Servlet filters, listeners Y Y Y(6) Y Y Y Y Y Other Java EE component classes (Table EE. 5-1) Y Y Y(6) Y Y Y Y Y JPA entities Y(6) JPA entity listeners (4) Y Y(6) Y Y Y Y Y Interceptors Y Y Y(6) Y Y Decorators Y Y Y Y Producer methods Y(3) Y(5) Y(5) Y Y (2)(3) Y(2) Producer fields Y(2) Y(2) Disposer methods Y(3) Y(5) Y(5) Y Y(3) Observer methods Y(3) Y(5) Y(5) Y Y(3)
28.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Program Agenda EJB – History, Goals, Evolution CDI– History, Goals, Evolution Advantages/disadvantages – when to use EJB/CDI Java EE – Managed Bean Alignment What is our strategy for the future 1 2 3 4 5 28
29.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | CDI and EJB: Bridging the Gap in Java EE 8 • Java EE 8 continues the theme of Managed-Bean Alignment • Container-managed security: authorization • Message-driven beans Expanded use of EJB Container Services 29
30.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Proposed: Authorization via Security Interceptors @IsAuthorized("hasRoles('Manager') && schedule.officeHrs") public void transferFunds() {...} @IsAuthorized("hasRoles('Manager') && hasAttribute('directReports', employee.id)") public double getSalary(int employeeId) {...} @IsAuthorized(ruleSourceName="java:app/payrollAuthRules", rule="report") public void displayReport() {...}; Java EE Security 1.0 (Java EE 8) 30
31.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Message-driven Beans • Alternative to EJB message-driven beans • Usable by any CDI managed bean • Simpler JMS-specific annotations • No need for MessageListener implementation JMS 2.1: New API to receive messages asynchronously (Java EE 8) 31
32.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Message-driven Beans @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName="connectionFactoryLookup", propertyValue="jms/myCF"), @ActivationConfigProperty(propertyName="destinationLookup", propertyValue="jms/myQueue"), @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms/Queue")} public class MyMDB implements MessageListener { public void onMessage(Message message) { // extract message body String body = message.getBody(String.class)); // process message body } } EJB MDBs Today (Java EE 7) 32
33.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Proposed: Message-driven Beans @RequestScoped public class MyListenerBean { @JMSListener(destinationLookup="jms/myQueue") @Transactional public void myCallback(Message message) { ... } } JMS 2.1 Tomorrow: Allow any Java EE bean to be a listener (Java EE 8) 33
34.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Bridging the Gap • JAX-RS Injection alignment • Parameter injection • Scope for WebSocket endpoints • Extension of Timer Service and Timer notifications (@Schedule) • … Other Areas of Alignment 34
35.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Some Gaps Remain • Java EE components are CDI managed beans – They can be injected with @Inject – But, Java EE components other than session beans lose their Java EE "componentness" – E.g., you can inject a servlet into a managed bean, but the injected instance won't still service web requests 35
36.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Summary • Java EE 6 – Interceptors • Java EE 7 – Container-managed transactions transactional interceptors • Java EE 8 – Container-managed authorization security interceptors – Message-driven beans simplified messaging with CDI-based MDBs • Java EE 9 – Timer Service (?) – Timed Events (?) – … (?) EJB Features made more broadly available through CDI 36
37.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | What is the Future of EJB? • Part of EJB becoming Optional – EJB Entity Beans, EJB QL • Optional as of Java EE 7; superseded by JPA – Support for JAX-RPC • Optional as of Java EE 7; superseded by JAX-WS – IIOP Interoperability ?? • Java EE 8 Experts will decide on "Proposed Optional" status – Remote interfaces ?? • Java EE 8 Experts will decide on "Proposed Optional" status – Optionality process is slow • Takes 2 Java EE Platform release cycles 37
38.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | What is the Future of EJB? • Important EJB features are being made more broadly available – Interceptors, container-managed txs and security, MDBs, … – Availability is through mechanisms of CDI • Will EJB still be relevant ? • EJB's long-term future depends on the future of remaining features – Remote access (RMI, Web Services) – @Schedule'd events and Timer Service – Singletons - @Startup; @DependsOn; container-managed concurrency – Asynchronous methods – Integration with JPA 38
39.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | How You Can Influence the Discussion • Adopt a JSR – http://glassfish.org/adoptajsr • Join an Expert Group project – http://javaee-spec.java.net – https://java.net/projects/javaee-spec/pages/Specifications • The Aquarium – http://blogs.oracle.com/theaquarium • Java EE 8 Reference Implementation – http://glassfish.org 39
40.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 40
41.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. | 41