Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java EE 6: Switching to CDI - Best resources

Tags:

I have a small yet complete Java EE 6 application at hand.

The traditional annotations are being used: @Resource, @EJB, @Singleton, @PostConstruct, @PreDestroy, @PersistenceContext, @ManagedBean, @ManagedProperty, @RequestScope, @ApplicationScope,...

I would like to evaluate whether it makes sense to introduce CDI, and to standardize on a common strategy for dependency injection, bean lifecycle management, etc.

Question: Does anybody know about good articles, examples or manuals that transform traditional Java EE 6 annotations into CDI ones?

like image 287
Jan Avatar asked Aug 04 '10 08:08

Jan


2 Answers

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

  • Are @ManagedBean’s obsolete in JavaEE6 - because of @Named in CDI/Weld?
like image 176
Pascal Thivent Avatar answered Sep 28 '22 09:09

Pascal Thivent


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.

like image 29
Wolkenarchitekt Avatar answered Sep 28 '22 10:09

Wolkenarchitekt