Ray's playground

 

Spring and Enterprise JavaBeans(Chapter 11 of Spring In Action)

  Although Spring’s POJO-based development model offers a compelling alternative to Enterprise JavaBeans, there may be factors (either technical, political, or historical) that force a project to choose EJBs. In those cases, there’s no need to dismiss Spring entirely, as Spring supports both EJB development and consumption.

  Using EJB proxies, we declared references to EJBs in a Spring application context. Once configured in Spring, the EJB could then be wired into other Spring beans that will consume the EJB’s services. We also looked at how EJB proxy declaration is made simpler using Spring 2.0’s <jee:local-slsb> and <jee:remote-slsb> configuration elements.

  We then turned our attention to developing EJBs. Even though Spring doesn’t provide a mechanism for directly hosting 2.x EJBs in the Spring container, Spring

does provide a set of Spring-aware base classes from which EJBs can be developed.

  These base classes expose the Spring application context to the EJB so that the EJB can delegate its work to Spring-managed POJOs. Finally, we peeked at Pitchfork, an intriguing Spring add-on that enables the use of EJB 3 annotations for dependency injection and AOP within a Spring container. 

posted on 2010-07-25 11:36  Ray Z  阅读(229)  评论(0编辑  收藏  举报

导航