This presentation talks about 2.5 and the future (3.0).
2.5 summary:
- 2.0 kernel so-to-say plus additional features.
- end of 1.3 support (who cares? ;););) )
- JDK 1.6 support: JDBC 4.0, JMX MXBeans (supports runtime snapshots)
- AspectJ load-time weaving (available in 2.0 but not mainstream as in 2.5) through a platform support or a generic Spring VM agent using <context:load-time-weaver />
- JEE 5.0 support (JPA support is improved, EclipseLink support) and all other JEE 5.0 APIs
A bit of details on 2.5:
JSR 250 Common Annotations:
Good: @PostConstruct, @PreDestroy
Bad: @Resource ;);) of course, this annotation is a bit limited (injects a resource from JNDI from a name in a setter or field)... yet a standard. Life is a bitch... though Spring allows using it without JNDI :).
Other annotations:
- @WebServiceRef/@EJB (should have been named @EJBRef... life is really a bitch)
- @TransactionAttribute (EJB 3 transaction demarcation... a bit limited)
- @PersistenceContext / @PersistenceUnit already supported in 2.0: JPA resource injection
@Autowired Spring annotation
- on fields, configuration methods, constructors
- nice sweet-spot between autowiring by type and autowiring by name: annotation-driven, less wild-guessing.
- @Qualifier allows to narrow the potential autowired components if multiple are available. This is also available in the xml syntax in beans. Qualifier can be a bean name or an annotation applied to a bean.
@Configurable with AspectJ
- classes can be weaved and may be created by using a simple "new" constructor call!
- using <context:load-time-weaver aspectj-weaving="on"/> and <context:spring-configured /> (and of course the appropriate class-loader/agent).
@Transactional with AspectJ
- using <context:load-time-weaver aspectj-weaving="on"/> and <tx:annotation-driven mode="aspectj" transaction-manager="......
- avoids creation of proxies by using load-time weaving.
- also works for private and protected methods, and for code from same component (common problem with proxies).
Annotated MVC:
- @Controller, @RequestMapping...etc (I already tested it, you should try it ;) )
- allows POJO Controllers for classic methods, or in portlets...
Test Context Framework:
- @ContextConfiguration, @TransactionConfiguration
- works with JUnit 4.4 (@RunWith(SpringJUnit4ClassRunner.class)) and TestNG
- no use of class hierarchies... nice and light ;) (a bit troubling though as the test almost contains anything except metadata....)
Recommandations:
- Option 1: XML-based configuration complemented with annotations.
- Option 2: more radical: Fully annotated components. (Not that much an XML hater... so it seems a bit over-strict)...
- Externalized configuration => XML
- Embedded configuration => Annotations
- Find the balance, and mix and match!!!
Spring 3.0 insights:
- Spring 2.5.5,2.5.6 up until July (OSGI refinements)
- Spring 3.0 RC1 (August)
- Spring 3.0 GA in Q4: Java 5 in the core (internal use of Generics and varargs), support of Portlet 2.0, preparation of Servlet 3.0, => REST support, EL support, conversational support...
- Backwards compatibility with removal of deprecated APIs.
Pruning and Deprecation:
-prune: Commons Attributes
-prune: Toplink (EclipseLink)
-deprecated: pre JDK 5.0 support
mercredi, juin 11, 2008
Inscription à :
Publier les commentaires (Atom)

0 commentaires:
Enregistrer un commentaire