SlideShare a Scribd company logo
Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI 
Mario-Leander Reimer 
mario-leander.reimer@qaware.de 
QAware
2| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
This talkwill … 
Give a brief overview of the system’s architecture 
Try to explain the rationale behind the migration 
Outline differences and similarities between both technologies 
Show patternsandstrategiesused during the migration to translate the different concepts 
Discuss implications on the system’s architecture 
Highlight problems, challenges and lessons learned
3| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
A<<Application Cluster>> AIR LoaderMechanicA<<System>> AIR CentralA<<Subsystem>> MaintenanceA<<System>> AIR RepositoryI<<Subsystem>> Apache SolrA<<Client>> AIR ClientI<<Subsystem>> .NET WPFA<<Subsystem>> Solr ExtensionsA<<Subsystem>> DefectsA<<Subsystem>> Flat RatesA<<Subsystem>> Service BulletinsServiceTechnicianA<<Ext. System>> 3rd Party ApplicationA<<Subsystem>> AIR Fork DLLA<<Subsystem>> AIR Call DLLLaunchI<<Subsystem>> Spring FrameworkI<<Subsystem>> JEE 5A<<System>> AIR ControlI<<Subsystem>> JenkinsA<<Subsystem>> DocumentsA<<Subsystem>> VehiclesA<<Subsystem>> MeasuresBackend Databasesand SystemsA<<Subsystem>> Repair OverviewA<<Subsystem>> MasterdataA<<Subsystem>> JSF Web UIA<<Subsystem>> REST APIIndependentWorkshopA<<Client>> BrowserSearch andDisplayA<<Ext. System>> 3rd Party iOS AppA<<Subsystem>> AIR iOS LibA<<Subsystem>> DefectsA<<Subsystem>> Flat RatesA<<Subsystem>> Service BulletinsI<<Subsystem>> Spring FrameworkA<<Subsystem>> DocumentsA<<Subsystem>> PartsA<<Subsystem>> WS ClientsA<<Subsystem>> File StorageA<<Subsystem>> Solr AccessA<<Subsystem>> ProtocollA<<Subsystem>> WatchlistA<<Subsystem>> MasterdataA<<Subsystem>> RetrofitsAIR DBDocumentStorageA<<Ext. System>> AIR BusI<<Ext. System>> Backend SystemsQueryA<<Subsystem>> VehiclesExecuteLoad400 GBSolr IndexA<<Subsystem>> Maintenance
4| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Whywouldyouwanttomigratea stableandrunningsystem? 
The shortanswer: IT governance. 
The longanswer: 
JEE nowprovidesthesame functionalityandisa standard 
Easy andcostefficientmigrationtofutureJEE versions 
Lowercostsforweb infrastructureandapplicationoperations 
Easy applicationmaintenanceby*-shorecompanies 
Noadditional vendorsupportrequired, noadditional costs
5| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer
6| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Annotation basedwiringofcomponentsusingconstructorinjection
7| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
UsageofcustomSpring annotationsformoreexpressiveness
8| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
XML basedwiringofcomponentsforSpring specificbeansandmorecomplexcomponents
9| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
FactoryBeanstobuildbeaninstanceswithregularJava code
10| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Usageofpropertyplaceholdersupporttoinjectconfigurationvalues
11| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Implementation ofAspectJbasedproxiesforcrosscuttingconcerns
12| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
ProgrammaticbeanlookupusingtheRegistry patternandtheApplicationContext
13| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
UsageofSpring beanprofilesforenvironmentspecificbeanconfigurations
14| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Spring XML namespacesforsyntacticsugar
15| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Unit andmoduletestsheavilyuseandrelyon theSpring Testing framework
16| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Wewerefacedwithmorequestionsthanwehadanswersfor 
How to migrate basic annotation based bean wiring? 
How to migrate XML based bean wiring and factory beans? 
How to migrate Spring property placeholder support? 
How to migrate AspectJ based AOP proxies? 
How to migrate programmatic bean lookups? 
How to migrate Spring bean profiles? 
How to migrate custom Spring XML namespaces? 
How to migrate code that is built against Spring APIs? 
How to migrate unit test based on Spring Test?
17| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer
18| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer
19| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
All new Java EE 7 Maven Coordinates
20| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Individual Mavenmodulesasmainunitofmigration 
ReplaceSpring annotationsandwiringswithCDI equivalent 
ReplaceXML contextdefinitionswithbeans.xml 
Optional: adjustcomponentstobenefitfromCDI 
Find and/orbuildsubstitutesforSpring specificfeatures 
Adjustunitandintegrationtests
21| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Basic Spring toCDI annotationmigrationisstraightforward, withsubtledifferences 
Caution: Spring andCDI havea different defaultscope! 
CDI usesclientproxiesper default(exceptfor@Dependent), in Spring youhavetodo thisexplicitly. 
This mightinfluenceyourwiringstyle. Becarefulwithfinal. 
Spring Annotation 
CDI Annotation 
@Component(„myBean“) 
 
@Named(„myBean“) 
@Scope(„singleton“) 
 
@ApplicationScoped 
@Scope(„prototype“) 
 
@Dependent 
@Scope(„request“) 
 
@RequestScoped 
@Scope(„session“) 
 
@SessionScoped 
@Autowired 
 
@Inject 
Default 
Default
22| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Bothtechnologiessupport@Qualifiertodistinguishvariousimplementations 
Tip: do not use@Namedtoqualifyyourcomponentsin CDI, use 
custom@Qualifierannotationsinstead.
23| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
@Stereotype istheCDI equivalenttocustom@Componentannotations 
Tip: check the@Target annotationoftheCDI stereotype, and 
includeMETHODso itcanbeappliedto@Producesmethods.
24| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Migrate*-components.xml tobeans.xml 
Tip: useCDI 1.1 bean-discovery-mode=„annotated“ 
astheequivalenttoSpring‘scomponentscan.
25| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
XML based bean wiring as well as factory beans are migrated to Producer methods 
-Factory beanscanalso usedependencyinjection 
-Support forlifecycle 
-Constructorinjection 
-Nestedfactorybean
26| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
XML based bean wiring as well as factory beans are migrated to Producer methods
27| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
ThereisnodirectequivalenttoSpring‘s@Value(„${some.property}“) annotation
28| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Property injectionsupportforCDI usingtheDeltaSpikeConfigurationMechanism 
Tip: havea lookat Apache DeltaSpikebeforeyoustartbuilding 
yourowncustomCDI extensionsformissingfeatures.
29| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Migrating Spring AOP using @Interceptor and @InterceptorBindingannotations 
Activate aspectsandautoproxy 
relevant beans 
Pointcutforall publicmethodsin classesannotatedwith@Service 
Pointcutforall publicmethodsin classesannotatedwith@Repository
30| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Migrating Spring AOP using @Interceptor and @InterceptorBindingannotations
31| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
The CDI way for programmatic bean lookup improved our code enormously 
BeanManageristhe~ equivalenttoApplicationContext 
MigratedApplicationContextAwarestaticregistryclasstousetheBeanManagerinstead 
Advice: don‘tuseBeanManagerdirectly.It‘stoolowlevel. Don‘tusea staticregistryeither. Gruesometestability! 
Tip: ifstaticaccesstocontextualreferencesisreallyrequired, usetheDeltaSpikeBeanProviderimplementation.
32| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Are Alternatives theequivalenttoSpring‘sbeandefinitionprofiles? Almost. 
Problem: Alternatives needtobeactivatedin thebean.xml 
Not suitableforenvironmentspecific, dynamicactivation. 
Usea CDI extensiontovetoannotatedtype ifprofileisnot active. 
Alternative: UsetheDeltaSpikeProjectStagemechanism.
33| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
The migrationofourcustomSpring XML namespacesseemedtobea challenge 
Create instanceoftype FiniteStateMachinewithgivenID asbeanname 
Enumtype definitions 
Create transitioninstancewithgivenproperties 
Bean lookupbynameforactioninstancetoexecute
34| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Programmaticapproach: combineBuilderpatternwitha producermethod 
Usedfornamedaction 
beanlookup
35| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Improvedapproach: usea CDI extensiontoreadXML filesandcreateFSM beans 
Createsinstances, usestheBuilderfromfirstapproach
36| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
DirectusageofsimplifiedJMS 2.0 API insteadofSpring‘sJmsTemplate 
Sending 
Receiving
37| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
ReplacingSpring‘sTesting Framework was painfulanda lotofwork 
SpringJUnit4ClassRunnerMockitoJUnitRunner 
This workreallypaidof 
Simplifiedunittestswithbetterisolation 
decreasedexecutiontime 
Different approachesandtestrunnersforCDI testsavailable: 
JglueCDI-Unit: @RunWith(CdiRunner.class) 
DeltaSpikeTest-Control: @RunWith(CdiTestRunner.class) 
Arquillian: @RunWith(Arquillian.class) 
Testing a CDI enabledJAR in isolationiscomplexandlaborious(orjust didn‘twork)
38| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
Andtherewas a lotmorecodetomigrate 
MigratedSpring taskexecutionandschedulingfuntionalityto@AsyncmethodsorJEE7 ManagedExecutorService 
The JPA persistencecodemigrationwentsmoothly 
Migratedpersistence.xml fromJPA 1.0 to2.1 
Simple JPA unittestsusingDBUnitfortestdatasetup 
The JSF web layermigrationwas quitetedious 
Homogenizeannotationusage: replacedFacesbeanannotationswithCDI equivalent(e.g. @ManagedBean@Named) 
RemovedRegistry basedlookupofservicefacadeinstances 
Migratedandsimplifiedunittests, thisalso improvedtestquality
39| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
28 daysand300K LOC later…
40| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
28 daysand300K LOC later… 
… wehadtheAIR Central web applicationfullymigratedandrunningon Glassfishv4. 
Migration effortswereordersofmagnitudelowerthaninitiallyestimatedandanticipated! 
The standaloneAIR Loaderapplicationswerenexttomigrate: 
usingCDI fromJava SE, 
evenmorecomplexSpring XML namespace, 
comprehensiveusageofSpring JDBC.
41| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 
LessonsLearnedandResumé 
JEE7 andCDI havedefinitelycaughtupon Spring 
Therewas noSpring featurethatcouldnot bemigrated 
Someconvenienceisstill missing, but 
CDI provideslightweightandeasy touseextensionmechanisms, 
thereisgrowingsupportfromtheOpen Source community. 
Questionandrethinkestablishedpatternsandbestpractices 
More carefulwhenusingandbindingtoa specificframework
QUANTENSPRUNG DANK ANDERSDENKEN
Ad

Recommended

PPTX
WEKA: The Knowledge Flow Interface
DataminingTools Inc
 
PPT
GlassFish Story by Kerry Wilson/Vanderbilt University Medical Center
glassfish
 
PDF
Spring - CDI Interop
Ray Ploski
 
PPTX
Java EE vs Spring Framework
Rohit Kelapure
 
PDF
jDays2015 - JavaEE vs. Spring Smackdown
Mert Çalışkan
 
PDF
JavaOne 2011: Migrating Spring Applications to Java EE 6
Bert Ertman
 
PDF
Spring In Action 1 Illustrated Edition Craig Walls Ryan Breidenbach
sapatpaties
 
PPTX
Java EE 7 for Real Enterprise Systems
Hirofumi Iwasaki
 
PPT
Spring 3.1: a Walking Tour
Joshua Long
 
PPT
Java EE 6 & Spring: A Lover's Quarrel
Mauricio "Maltron" Leal
 
PDF
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Shekhar Gulati
 
PDF
Advance Java Training in Bangalore | Best Java Training Institute
TIB Academy
 
PPT
Java EE and Spring Side-by-Side
Reza Rahman
 
PDF
Get Java EE Development with Eclipse - Second Edition Ram Kulkarni free all c...
quachaoishe
 
PDF
CDI Best Practices with Real-Life Examples - TUT3287
Ahmad Gohar
 
PDF
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 
PPTX
Top 50 java ee 7 best practices [con5669]
Ryan Cuprak
 
PDF
S313557 java ee_programming_model_explained_dochez
Jerome Dochez
 
PDF
Andrei Niculae - JavaEE6 - 24mai2011
Agora Group
 
PDF
ApacheCon EU 2014: Enterprise Development with Apache Karaf
Achim Nierbeck
 
PDF
Moving to Java EE 6 and CDI and away from the clutter
Dan Allen
 
PDF
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
Rohit Kelapure
 
PDF
Beginning java ee_7
Rodrigo Hiemer
 
PDF
Java EE Technical Keynote - JavaOne India 2011
Arun Gupta
 
PDF
Java EE 6 Hands-on Workshop at Dallas Tech Fest 2010
Arun Gupta
 
PDF
Java E
Arun Gupta
 
PDF
Vaadin 7 - Java Enterprise Edition integration
Peter Lehto
 
ODP
Javaee6 Overview
Carol McDonald
 
PDF
Steinzeit war gestern! Vielfältige Wege der Cloud-nativen Evolution.
Mario-Leander Reimer
 
PDF
A Hitchhiker's Guide to Cloud Native Java EE
Mario-Leander Reimer
 

More Related Content

Similar to Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDI (20)

PPT
Spring 3.1: a Walking Tour
Joshua Long
 
PPT
Java EE 6 & Spring: A Lover's Quarrel
Mauricio "Maltron" Leal
 
PDF
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Shekhar Gulati
 
PDF
Advance Java Training in Bangalore | Best Java Training Institute
TIB Academy
 
PPT
Java EE and Spring Side-by-Side
Reza Rahman
 
PDF
Get Java EE Development with Eclipse - Second Edition Ram Kulkarni free all c...
quachaoishe
 
PDF
CDI Best Practices with Real-Life Examples - TUT3287
Ahmad Gohar
 
PDF
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 
PPTX
Top 50 java ee 7 best practices [con5669]
Ryan Cuprak
 
PDF
S313557 java ee_programming_model_explained_dochez
Jerome Dochez
 
PDF
Andrei Niculae - JavaEE6 - 24mai2011
Agora Group
 
PDF
ApacheCon EU 2014: Enterprise Development with Apache Karaf
Achim Nierbeck
 
PDF
Moving to Java EE 6 and CDI and away from the clutter
Dan Allen
 
PDF
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
Rohit Kelapure
 
PDF
Beginning java ee_7
Rodrigo Hiemer
 
PDF
Java EE Technical Keynote - JavaOne India 2011
Arun Gupta
 
PDF
Java EE 6 Hands-on Workshop at Dallas Tech Fest 2010
Arun Gupta
 
PDF
Java E
Arun Gupta
 
PDF
Vaadin 7 - Java Enterprise Edition integration
Peter Lehto
 
ODP
Javaee6 Overview
Carol McDonald
 
Spring 3.1: a Walking Tour
Joshua Long
 
Java EE 6 & Spring: A Lover's Quarrel
Mauricio "Maltron" Leal
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Shekhar Gulati
 
Advance Java Training in Bangalore | Best Java Training Institute
TIB Academy
 
Java EE and Spring Side-by-Side
Reza Rahman
 
Get Java EE Development with Eclipse - Second Edition Ram Kulkarni free all c...
quachaoishe
 
CDI Best Practices with Real-Life Examples - TUT3287
Ahmad Gohar
 
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 
Top 50 java ee 7 best practices [con5669]
Ryan Cuprak
 
S313557 java ee_programming_model_explained_dochez
Jerome Dochez
 
Andrei Niculae - JavaEE6 - 24mai2011
Agora Group
 
ApacheCon EU 2014: Enterprise Development with Apache Karaf
Achim Nierbeck
 
Moving to Java EE 6 and CDI and away from the clutter
Dan Allen
 
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
Rohit Kelapure
 
Beginning java ee_7
Rodrigo Hiemer
 
Java EE Technical Keynote - JavaOne India 2011
Arun Gupta
 
Java EE 6 Hands-on Workshop at Dallas Tech Fest 2010
Arun Gupta
 
Java E
Arun Gupta
 
Vaadin 7 - Java Enterprise Edition integration
Peter Lehto
 
Javaee6 Overview
Carol McDonald
 

More from Mario-Leander Reimer (20)

PDF
Steinzeit war gestern! Vielfältige Wege der Cloud-nativen Evolution.
Mario-Leander Reimer
 
PDF
A Hitchhiker's Guide to Cloud Native Java EE
Mario-Leander Reimer
 
PDF
Steinzeit war gestern! Die vielfältigen Wege der Cloud-nativen Evolution
Mario-Leander Reimer
 
PDF
Everything-as-code: DevOps und Continuous Delivery aus Sicht des Entwicklers....
Mario-Leander Reimer
 
PPTX
Das kleine Einmaleins der sicheren Architektur @heise_devSec
Mario-Leander Reimer
 
PDF
Polyglot Adventures for the Modern Java Developer #javaone2017
Mario-Leander Reimer
 
PDF
Elegantes In-Memory Computing mit Apache Ignite und Kubernetes. @data2day
Mario-Leander Reimer
 
PDF
Cloud-native .NET-Microservices mit Kubernetes @BASTAcon
Mario-Leander Reimer
 
PDF
A Hitchhiker’s Guide to the Cloud Native Stack. #DevoxxPL
Mario-Leander Reimer
 
PDF
Everything-as-code. A polyglot adventure. #DevoxxPL
Mario-Leander Reimer
 
PDF
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17
Mario-Leander Reimer
 
PDF
Per Anhalter durch den Cloud Native Stack. #SEACONHH
Mario-Leander Reimer
 
PDF
Everything-as-code. Ein polyglottes Abenteuer. #jax2017
Mario-Leander Reimer
 
PDF
Everything-as-code. Eine vielsprachige Reise. #javaland
Mario-Leander Reimer
 
PDF
Everything as-code. Polyglotte Entwicklung in der Praxis. #oop2017
Mario-Leander Reimer
 
PDF
Per Anhalter durch den Cloud Native Stack (Extended Edition) #oop2017
Mario-Leander Reimer
 
PDF
Der Cloud Native Stack in a Nutshell. #CloudExpoEurope
Mario-Leander Reimer
 
PDF
A Hitchhiker’s Guide to the Cloud Native Stack. #ContainerConf
Mario-Leander Reimer
 
PDF
Secure Architecture and Programming 101
Mario-Leander Reimer
 
PDF
Automotive Information Research driven by Apache Solr
Mario-Leander Reimer
 
Steinzeit war gestern! Vielfältige Wege der Cloud-nativen Evolution.
Mario-Leander Reimer
 
A Hitchhiker's Guide to Cloud Native Java EE
Mario-Leander Reimer
 
Steinzeit war gestern! Die vielfältigen Wege der Cloud-nativen Evolution
Mario-Leander Reimer
 
Everything-as-code: DevOps und Continuous Delivery aus Sicht des Entwicklers....
Mario-Leander Reimer
 
Das kleine Einmaleins der sicheren Architektur @heise_devSec
Mario-Leander Reimer
 
Polyglot Adventures for the Modern Java Developer #javaone2017
Mario-Leander Reimer
 
Elegantes In-Memory Computing mit Apache Ignite und Kubernetes. @data2day
Mario-Leander Reimer
 
Cloud-native .NET-Microservices mit Kubernetes @BASTAcon
Mario-Leander Reimer
 
A Hitchhiker’s Guide to the Cloud Native Stack. #DevoxxPL
Mario-Leander Reimer
 
Everything-as-code. A polyglot adventure. #DevoxxPL
Mario-Leander Reimer
 
A Hitchhiker’s Guide to the Cloud Native Stack. #CDS17
Mario-Leander Reimer
 
Per Anhalter durch den Cloud Native Stack. #SEACONHH
Mario-Leander Reimer
 
Everything-as-code. Ein polyglottes Abenteuer. #jax2017
Mario-Leander Reimer
 
Everything-as-code. Eine vielsprachige Reise. #javaland
Mario-Leander Reimer
 
Everything as-code. Polyglotte Entwicklung in der Praxis. #oop2017
Mario-Leander Reimer
 
Per Anhalter durch den Cloud Native Stack (Extended Edition) #oop2017
Mario-Leander Reimer
 
Der Cloud Native Stack in a Nutshell. #CloudExpoEurope
Mario-Leander Reimer
 
A Hitchhiker’s Guide to the Cloud Native Stack. #ContainerConf
Mario-Leander Reimer
 
Secure Architecture and Programming 101
Mario-Leander Reimer
 
Automotive Information Research driven by Apache Solr
Mario-Leander Reimer
 
Ad

Recently uploaded (20)

PDF
From Data Preparation to Inference: How Alluxio Speeds Up AI
Alluxio, Inc.
 
PPTX
Top Time Tracking Solutions for Accountants
oliviareed320
 
PDF
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
PDF
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
PPTX
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
PDF
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
PDF
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
 
PDF
Canva Pro Crack Free Download 2025-FREE LATEST
grete1122g
 
DOCX
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
PPTX
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
 
PDF
Heat Treatment Process Automation in India
Reckers Mechatronics
 
PDF
Best Software Development at Best Prices
softechies7
 
PDF
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
 
PPTX
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
 
PDF
Building Geospatial Data Warehouse for GIS by GIS with FME
Safe Software
 
PDF
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
PPTX
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
 
DOCX
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
PDF
OpenChain Webinar - AboutCode - Practical Compliance in One Stack – Licensing...
Shane Coughlan
 
PDF
Complete WordPress Programming Guidance Book
Shabista Imam
 
From Data Preparation to Inference: How Alluxio Speeds Up AI
Alluxio, Inc.
 
Top Time Tracking Solutions for Accountants
oliviareed320
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
 
Canva Pro Crack Free Download 2025-FREE LATEST
grete1122g
 
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
 
Heat Treatment Process Automation in India
Reckers Mechatronics
 
Best Software Development at Best Prices
softechies7
 
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
 
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
 
Building Geospatial Data Warehouse for GIS by GIS with FME
Safe Software
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
OpenChain Webinar - AboutCode - Practical Compliance in One Stack – Licensing...
Shane Coughlan
 
Complete WordPress Programming Guidance Book
Shabista Imam
 
Ad

Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDI

  • 1. Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI Mario-Leander Reimer [email protected] QAware
  • 2. 2| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer This talkwill … Give a brief overview of the system’s architecture Try to explain the rationale behind the migration Outline differences and similarities between both technologies Show patternsandstrategiesused during the migration to translate the different concepts Discuss implications on the system’s architecture Highlight problems, challenges and lessons learned
  • 3. 3| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer A<<Application Cluster>> AIR LoaderMechanicA<<System>> AIR CentralA<<Subsystem>> MaintenanceA<<System>> AIR RepositoryI<<Subsystem>> Apache SolrA<<Client>> AIR ClientI<<Subsystem>> .NET WPFA<<Subsystem>> Solr ExtensionsA<<Subsystem>> DefectsA<<Subsystem>> Flat RatesA<<Subsystem>> Service BulletinsServiceTechnicianA<<Ext. System>> 3rd Party ApplicationA<<Subsystem>> AIR Fork DLLA<<Subsystem>> AIR Call DLLLaunchI<<Subsystem>> Spring FrameworkI<<Subsystem>> JEE 5A<<System>> AIR ControlI<<Subsystem>> JenkinsA<<Subsystem>> DocumentsA<<Subsystem>> VehiclesA<<Subsystem>> MeasuresBackend Databasesand SystemsA<<Subsystem>> Repair OverviewA<<Subsystem>> MasterdataA<<Subsystem>> JSF Web UIA<<Subsystem>> REST APIIndependentWorkshopA<<Client>> BrowserSearch andDisplayA<<Ext. System>> 3rd Party iOS AppA<<Subsystem>> AIR iOS LibA<<Subsystem>> DefectsA<<Subsystem>> Flat RatesA<<Subsystem>> Service BulletinsI<<Subsystem>> Spring FrameworkA<<Subsystem>> DocumentsA<<Subsystem>> PartsA<<Subsystem>> WS ClientsA<<Subsystem>> File StorageA<<Subsystem>> Solr AccessA<<Subsystem>> ProtocollA<<Subsystem>> WatchlistA<<Subsystem>> MasterdataA<<Subsystem>> RetrofitsAIR DBDocumentStorageA<<Ext. System>> AIR BusI<<Ext. System>> Backend SystemsQueryA<<Subsystem>> VehiclesExecuteLoad400 GBSolr IndexA<<Subsystem>> Maintenance
  • 4. 4| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Whywouldyouwanttomigratea stableandrunningsystem? The shortanswer: IT governance. The longanswer: JEE nowprovidesthesame functionalityandisa standard Easy andcostefficientmigrationtofutureJEE versions Lowercostsforweb infrastructureandapplicationoperations Easy applicationmaintenanceby*-shorecompanies Noadditional vendorsupportrequired, noadditional costs
  • 5. 5| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer
  • 6. 6| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Annotation basedwiringofcomponentsusingconstructorinjection
  • 7. 7| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer UsageofcustomSpring annotationsformoreexpressiveness
  • 8. 8| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer XML basedwiringofcomponentsforSpring specificbeansandmorecomplexcomponents
  • 9. 9| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer FactoryBeanstobuildbeaninstanceswithregularJava code
  • 10. 10| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Usageofpropertyplaceholdersupporttoinjectconfigurationvalues
  • 11. 11| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Implementation ofAspectJbasedproxiesforcrosscuttingconcerns
  • 12. 12| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer ProgrammaticbeanlookupusingtheRegistry patternandtheApplicationContext
  • 13. 13| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer UsageofSpring beanprofilesforenvironmentspecificbeanconfigurations
  • 14. 14| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Spring XML namespacesforsyntacticsugar
  • 15. 15| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Unit andmoduletestsheavilyuseandrelyon theSpring Testing framework
  • 16. 16| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Wewerefacedwithmorequestionsthanwehadanswersfor How to migrate basic annotation based bean wiring? How to migrate XML based bean wiring and factory beans? How to migrate Spring property placeholder support? How to migrate AspectJ based AOP proxies? How to migrate programmatic bean lookups? How to migrate Spring bean profiles? How to migrate custom Spring XML namespaces? How to migrate code that is built against Spring APIs? How to migrate unit test based on Spring Test?
  • 17. 17| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer
  • 18. 18| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer
  • 19. 19| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer All new Java EE 7 Maven Coordinates
  • 20. 20| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Individual Mavenmodulesasmainunitofmigration ReplaceSpring annotationsandwiringswithCDI equivalent ReplaceXML contextdefinitionswithbeans.xml Optional: adjustcomponentstobenefitfromCDI Find and/orbuildsubstitutesforSpring specificfeatures Adjustunitandintegrationtests
  • 21. 21| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Basic Spring toCDI annotationmigrationisstraightforward, withsubtledifferences Caution: Spring andCDI havea different defaultscope! CDI usesclientproxiesper default(exceptfor@Dependent), in Spring youhavetodo thisexplicitly. This mightinfluenceyourwiringstyle. Becarefulwithfinal. Spring Annotation CDI Annotation @Component(„myBean“)  @Named(„myBean“) @Scope(„singleton“)  @ApplicationScoped @Scope(„prototype“)  @Dependent @Scope(„request“)  @RequestScoped @Scope(„session“)  @SessionScoped @Autowired  @Inject Default Default
  • 22. 22| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Bothtechnologiessupport@Qualifiertodistinguishvariousimplementations Tip: do not use@Namedtoqualifyyourcomponentsin CDI, use custom@Qualifierannotationsinstead.
  • 23. 23| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer @Stereotype istheCDI equivalenttocustom@Componentannotations Tip: check the@Target annotationoftheCDI stereotype, and includeMETHODso itcanbeappliedto@Producesmethods.
  • 24. 24| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Migrate*-components.xml tobeans.xml Tip: useCDI 1.1 bean-discovery-mode=„annotated“ astheequivalenttoSpring‘scomponentscan.
  • 25. 25| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer XML based bean wiring as well as factory beans are migrated to Producer methods -Factory beanscanalso usedependencyinjection -Support forlifecycle -Constructorinjection -Nestedfactorybean
  • 26. 26| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer XML based bean wiring as well as factory beans are migrated to Producer methods
  • 27. 27| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer ThereisnodirectequivalenttoSpring‘s@Value(„${some.property}“) annotation
  • 28. 28| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Property injectionsupportforCDI usingtheDeltaSpikeConfigurationMechanism Tip: havea lookat Apache DeltaSpikebeforeyoustartbuilding yourowncustomCDI extensionsformissingfeatures.
  • 29. 29| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Migrating Spring AOP using @Interceptor and @InterceptorBindingannotations Activate aspectsandautoproxy relevant beans Pointcutforall publicmethodsin classesannotatedwith@Service Pointcutforall publicmethodsin classesannotatedwith@Repository
  • 30. 30| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Migrating Spring AOP using @Interceptor and @InterceptorBindingannotations
  • 31. 31| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer The CDI way for programmatic bean lookup improved our code enormously BeanManageristhe~ equivalenttoApplicationContext MigratedApplicationContextAwarestaticregistryclasstousetheBeanManagerinstead Advice: don‘tuseBeanManagerdirectly.It‘stoolowlevel. Don‘tusea staticregistryeither. Gruesometestability! Tip: ifstaticaccesstocontextualreferencesisreallyrequired, usetheDeltaSpikeBeanProviderimplementation.
  • 32. 32| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Are Alternatives theequivalenttoSpring‘sbeandefinitionprofiles? Almost. Problem: Alternatives needtobeactivatedin thebean.xml Not suitableforenvironmentspecific, dynamicactivation. Usea CDI extensiontovetoannotatedtype ifprofileisnot active. Alternative: UsetheDeltaSpikeProjectStagemechanism.
  • 33. 33| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer The migrationofourcustomSpring XML namespacesseemedtobea challenge Create instanceoftype FiniteStateMachinewithgivenID asbeanname Enumtype definitions Create transitioninstancewithgivenproperties Bean lookupbynameforactioninstancetoexecute
  • 34. 34| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Programmaticapproach: combineBuilderpatternwitha producermethod Usedfornamedaction beanlookup
  • 35. 35| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Improvedapproach: usea CDI extensiontoreadXML filesandcreateFSM beans Createsinstances, usestheBuilderfromfirstapproach
  • 36. 36| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer DirectusageofsimplifiedJMS 2.0 API insteadofSpring‘sJmsTemplate Sending Receiving
  • 37. 37| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer ReplacingSpring‘sTesting Framework was painfulanda lotofwork SpringJUnit4ClassRunnerMockitoJUnitRunner This workreallypaidof Simplifiedunittestswithbetterisolation decreasedexecutiontime Different approachesandtestrunnersforCDI testsavailable: JglueCDI-Unit: @RunWith(CdiRunner.class) DeltaSpikeTest-Control: @RunWith(CdiTestRunner.class) Arquillian: @RunWith(Arquillian.class) Testing a CDI enabledJAR in isolationiscomplexandlaborious(orjust didn‘twork)
  • 38. 38| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer Andtherewas a lotmorecodetomigrate MigratedSpring taskexecutionandschedulingfuntionalityto@AsyncmethodsorJEE7 ManagedExecutorService The JPA persistencecodemigrationwentsmoothly Migratedpersistence.xml fromJPA 1.0 to2.1 Simple JPA unittestsusingDBUnitfortestdatasetup The JSF web layermigrationwas quitetedious Homogenizeannotationusage: replacedFacesbeanannotationswithCDI equivalent(e.g. @ManagedBean@Named) RemovedRegistry basedlookupofservicefacadeinstances Migratedandsimplifiedunittests, thisalso improvedtestquality
  • 39. 39| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 28 daysand300K LOC later…
  • 40. 40| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer 28 daysand300K LOC later… … wehadtheAIR Central web applicationfullymigratedandrunningon Glassfishv4. Migration effortswereordersofmagnitudelowerthaninitiallyestimatedandanticipated! The standaloneAIR Loaderapplicationswerenexttomigrate: usingCDI fromJava SE, evenmorecomplexSpring XML namespace, comprehensiveusageofSpring JDBC.
  • 41. 41| JavaOne2014 | Migrating a JSF-based web application from Spring 3 to Java EE 7 and CDI| M.-Leander Reimer LessonsLearnedandResumé JEE7 andCDI havedefinitelycaughtupon Spring Therewas noSpring featurethatcouldnot bemigrated Someconvenienceisstill missing, but CDI provideslightweightandeasy touseextensionmechanisms, thereisgrowingsupportfromtheOpen Source community. Questionandrethinkestablishedpatternsandbestpractices More carefulwhenusingandbindingtoa specificframework

Editor's Notes

  • #2: Detailed case study about the technology migration of a current project for a major German car manufacturer Ask audience: who uses Spring / who uses JEE? Disclaimer: No prejudice! No bashing on either technology. This talk is purely about technology.
  • #4: Some Facts: - Rollout since last year, by the end of this year world wide - 17250 concurrent sessions / h - Spring Framework with some JEE5 Glassfish v2 and JDK6 400K LOC, 200K Tests, 100K Generated, 100K Handwritten Good quality, good performance, good acceptance
  • #5: Blueprint approval required for all used open source libraries Benefit from latest bug fixes and technology improvements More efficient and faster development mit einem lachenden und einem weinenden Auge == with mixed feelings
  • #6: Our first reaction: no way this is possible in adequate time. This is like taking out and replacing the spine! But we were curious, it should definitely be possible.
  • #7: Usually only @Component is enough. You can also give your beans a name. @Scope support: singleton and prototype. Session and request also supported in combination with a webapp. Careful with injection  scoped proxies. Visibility guarantees, strong expression of dependencies
  • #8: More expressiveness: Custom Component annotations, like @Service or @Repository Custom Qualifiers for type safety
  • #12: Good old logging aspect example. measure execution times, echo parameters, start and end of invocation
  • #13: Service Locator pattern also called Registry
  • #15: An example: Spring DSL for a FiniteStateMachine. Other examples: other Spring namespaces, Mule ESB, Camel Looks fancy, but it is not really hard to implement: XSD, NamespaceHandler and BeanDefinition parser.
  • #16: Absolutely essential. Test basic wiring of components using mocks. Every Maven module has ist own integration test to test module wiring in isolation.
  • #17: You get the point. The longer you develop, the more you use technology to it‘s full potential. This is our migration agenda for the next 30 minutes.
  • #18: New technology and programming wouldn‘t be so much fun if it was boring and straight forward. It is those technically challanging projects that make live as a developer interesting and worthwhile. It was time to learn something new. Still unsure about the effort it would take.
  • #19: JEE7 Migration: Areas of Interests  a lot of congruence Spring – CDI Everything else  CDI Extensions (Deltaspike + Custom) Common Annotations Interceptors for AOP JPA Persistence JMS for Asnyc Stuff Enterprise Beans for Services (maybe) Concurrency for Replacement of Executors.* Servlets -> 3.0 with CDI Web Fragements New JSF + EL JAX-RS / JAX-WS
  • #20: All New Java EE 7 Maven Coordinates + 2 few more Definitely less than all the required Spring dependencies + transitive tail deps
  • #21: Every business component is usually composed of API, Core and UI module. Sometimes loader module. We have 100+ different Maven modules, all following the same pattern. But obviously with subtle differences in Spring API usage and wiring.
  • #22: No equivalent for @Scope(„globalSession“) in CDI No equivalent for @ConversationScoped in Spring Subtle differences: Default scope in Spring is Singleton, in CDI it is @Dependent In CDI you will get a client proxy, in Spring usually not. JSR-330: no @Required or @Lazy
  • #24: Characterize your components using stereotypes. @Component can be anything. Usually you also define the lifecycle using @Scope here also.
  • #26: A producer method acts as a source of objects to be injected, where: - the objects to be injected are not required to be instances of beans, - the concrete type of the objects to be injected may vary at runtime or - the objects require some custom initialization that is not performed by the bean constructor For example, producer methods let us: - expose a JPA entity as a bean, - expose any JDK class as a bean, - define multiple beans, with different scopes or initialization, for the same implementation class, or - vary the implementation of a bean type at runtime.
  • #27: A producer method acts as a source of objects to be injected, where: - the objects to be injected are not required to be instances of beans, - the concrete type of the objects to be injected may vary at runtime or - the objects require some custom initialization that is not performed by the bean constructor For example, producer methods let us: - expose a JPA entity as a bean, - expose any JDK class as a bean, - define multiple beans, with different scopes or initialization, for the same implementation class, or - vary the implementation of a bean type at runtime.
  • #28: No equivalent to Spring‘s @Value annotation in JSR-330.
  • #29: Tip: before you start building a CDI extension or missing feature, have a look at Apache DeltaSpike
  • #30: AOP as the swiss army nife for cross-cutting concerns: - Logging, security, transactions, …
  • #31: AOP as the swiss army nife for cross-cutting concerns: - Logging, security, transactions, …
  • #32: My most favourite CDI feature: programmtic bean lookup. The simplicity is just awesome. Provides all you need to get hold of desired instances. Good testability.
  • #33: Bean definition profiles: enhancements in Spring Framework 3.1 Don‘t forget to activate the stereotype in beans.xml Naive approach: Alternatives and stereotype activation. Better: use DeltaSpike ProjectStages. Optimal: Build a custom CDI extension.
  • #35: Main advantage: it‘s code. It‘s readable and testable. Slight disadvantage: does get quite long for big FSMs. Also you need to hand code it.
  • #36: Idea: reuse the existing XML definitions for the FSMs. Parse these configurations and build bean instances. Again, the Apache DeltaSpike project saved us a lot of work. 3h and 290 LOC, comments included. https://github.com/rmannibucau/cdi-light-config
  • #38: We often used Spring tests with injection and mocks. Migrated towards Mockito mocks and injection. No problem.
  • #40: Nothing to be scared of anymore. CDI from Java SE  DeltaSpike Core
  • #41: Nothing to be scared of anymore. CDI from Java SE  DeltaSpike Core
  • #42: http://realworldpatterns.com/ - Real world Java EE Patterns. Rethinking Best Practices. You live and learn: man lernt nie aus! Basics are easy to understand and implement. And mostly sufficient. Basics: this also applies to building Spring based applications.