This article would overview the differences between Spring Framework and EJB 3
EJB 3.0
- EJB 3.0 is a specification.
- EJB is an architecture
- The EJB 3.0 framework is a standard framework defined by the Java Community Process (JCP) and supported by all major J2EE vendors. Open source and commercial implementations of pre-release EJB 3.0 specifications are already available .
Spring Framework
- Spring is an implementation.
- Spring is application framework
- The Spring framework is a popular but non-standard open source framework. It is primarily developed by and controlled by Interface21 Inc. Spring can work standalone or with existing application servers.
EJB 3.0 Advantages
- EJB 3.0 specification horroble old entity beans have been replaced with the JPA
- Deal with transactions and both succeed modularizing this functionality in a way that it doesn't clutter business logic
- Tune the transaction propagation levels via annotations
- Support state management via stateful session beans,
- Support injection of primitive types, allows injecting EJB's
- Supports AOP using interceptors
- Brings a basic implementation of component management
- Integrates with many popular persistence frameworks including JDBC, Hibernate, JDO, iBatis and JPA.
- Transaction demarcation, propagation, and isolation are all declared through its AOP.
- Support state management via prototype beans and also request, session, and global session scoping
- Support injection of any type, allows injection of any domain objects using the features of AspectJ
- Suppotrs AOP by tightly integrating with AspectJ with all of it's features
- Spring 2.0 offers a lot more power and customization, but the use of AspectJ actually makes the hard to learn
Spring Framework Disadvantages
- The idea of annotations was to stop work with XML - Deploymenet Descriptor files which were in EJB 2.1, but Spring encourage a lot the use of XML for dependency injection
- Refresh the Spring load data is impossible, if you change something in the configuration you need to restart the Application Server.
You can integrate Spring and EJB 3 technologies to take advantage of their relative strengths and weaknesses, In Spring and EJB 3 there are a lot of duplication in the compoments you can choose the best of this technologies to use in you application.
No comments:
Post a Comment