EJB3和Spring的比较

Last night I attended a New England Java User
Group (NEJUG) meeting where Reza Rahman presented a "comparative
analysis" of EJB 3 and Spring. Reza is one of the authors of EJB 3 in
Action. I enjoyed meeting Reza and respect him for presenting what may
be considered a controversial topic.

I will provide brief responses to 10 "themes" of the presentation.

1. EJB uses annotations for metadata. Spring uses XML.2. Spring allows you to support multiple deployment environments but requires more configuration.3. EJB with JPA, Spring with Hibernate4. Spring makes no assumptions, you have to provide configuration.5. Spring does not have a stateful application paradigm.6. Spring requires configuration of a container per MessageListener.7. Concurrent Consumers cannot be greater than 1.8. Spring's usage of the AspectJ expression language is powerful but cryptic.9. Spring tool support has been sparse.10. With EJB as a standard, you can migrate from one vendor to another. With Spring, you still have to port the metadata.