As a lightweight container, spring is often considered a substitute for EJB. We also believe that for many (not necessarily the vast majority) applications and use cases, compared to implementing the same function through the EJB container, Sping is used as the container, plus it in the transaction, spring is indeed a better choice for the wide range of features supported in the orm and JDBC access fields.
However, you must note thatSpringIt doesn't mean we can't use it.EJBIn fact, spring greatly simplifies the complexity of accessing and implementing the EJB component or only implementing the function of the EJB component. In addition, if you use spring to access the EJB component service, you can then transparently switch the service implementation between the local EJB component, remote EJB component, or pojo (simple Java object) variants, without modifying the clientCode.
Read: http://www.javah.net/JAVAjichu/20070609/2535.html