Java EE 6: passaggio a CDI - Best Resources
-
25-09-2019 - |
Domanda
Ho un'applicazione Java EE 6 piccola ma completa a portata di mano.
Le annotazioni tradizionali vengono utilizzate: @Resource
, @EJB
, @Singleton
, @PostConstruct
, @PreDestroy
, @PersistenceContext
, @ManagedBean
, @ManagedProperty
, @RequestScope
, @ApplicationScope
,...
Vorrei valutare se ha senso introdurre CDI e standardizzare su una strategia comune per l'iniezione di dipendenza, la gestione del ciclo di vita dei fagioli, ecc.
Domanda: Qualcuno sa di buoni articoli, esempi o manuali che trasformano le annotazioni tradizionali Java EE 6 in CDI?
Soluzione
Does anybody know about good articles, examples or manuals that transform traditional Java EE 6 annotations into CDI ones?
Not stricly about a "transformation" but very good resources IMO:
The Dependency Injection in Java EE 6 series - By Reza Rahman
The CDI RefCard on DZone
A Hitchhikers Guide to Java EE 6 application setup series - By Nicklas Karlsson
The Introducing the Java EE 6 Platform series
Related question
Altri suggerimenti
In my opinion, "switching" to CDI is no big deal. Just add a CDI implementation (like Weld) to your libraries, and start adding CDI Beans/Annotations to your app. You don't have to change your existing codebase. I would suggest reading the Weld reference.
If you plan to use JBoss CDI Implementation (Weld) you might be interested in this CDI with JBoss Weld article.
Following the line suggested I recommend reading :
In the same spirit, I like the following article:
Spring to Java EE – A Migration Experience
It's not about "Old-skool Java EE"-to-"CDI-based Java EE", but more about Spring-to-Java EE 6.
Off-topic, but an interesting read anyway.