Friday, June 09, 2006

More Spring Things

"Design enterprise applications with the EJB 3.0 Java Persistence API" lists injecting collaborators of a service using annotations such as "@EJB(beanName = "AccountDao")" to "AccountDao accountDao;".

This compares with Spring 2.0 examples that use the Spring configuration file to inject the collaborators: "JavaEE 5, Spring 2 and AspectJ 5: dependecy injection magics". Some more information, "7.7.1. Using AspectJ to dependency inject domain objects with Spring".

The other useful article is, "Don't repeat the DAO!" which allows the creation of type safe and generic DAOs. This uses dependency injection to put the class type to return and then uses Spring's AOP to add extra behaviour (like finder methods).
Post a Comment