When is it necessary or convenient to use Spring or EJB3 or all of them together?

前端 未结 2 2042
太阳男子
太阳男子 2020-11-22 03:08

I\'m a little confused by the mixed use of JSF2+Spring+EJB3 or any combination of those. I know one of the Spring principal characteristics is dependency injection, but with

2条回答
  •  暖寄归人
    2020-11-22 03:51

    There's no real easy answer here as Spring is many things.

    On a really high level, Spring competes with Java EE, meaning you would use either one of them as a full stack framework.

    On a finer grained level, the Spring IoC container and Spring Beans compete with the combination of CDI & EJB in Java EE.

    As for the web layer, Spring MVC competes with JSF. Some Spring xyzTemplate competes with the JPA interfaces (both can use eg Hibernate as the implementation of those).

    It's possible to mix and match; eg use CDI & EJB beans with Spring MVC, OR use Spring Beans with JSF.

    You will normally not use 2 directly competing techs together. Spring beans + CDI + EJB in the same app, or Spring MVC + JSF is silly.

提交回复
热议问题