What is an Enterprise Java Bean really?

前端 未结 7 1866
小鲜肉
小鲜肉 2021-02-05 18:59

On the Tomcat FAQ it says: \"Tomcat is not an EJB server. Tomcat is not a full J2EE server.\"

But if I:

  • use Spring to supply an application context
  • <
7条回答
  •  误落风尘
    2021-02-05 19:19

    1) You're confusing JPA entities with EJBs. While JPA belongs to the EJB3 specification, it was always meant to be a standalone technology.

    2) EJBs are: stateless beans, stateful beans and message driven beans. While each of these functionalities can easily be achieved using spring, spring just does not use this terminology. In Spring, you don't have POJO + "magic" as in EJBs, in Spring it's POJO + your own configuration (which sometimes feels like magic, too). The main difference is that spring does more and the application server does less, which is why a spring app is happy with a tomcat while an ejb3 app needs a 'real' application server.

    In my opinion, 90% of applications can be deployed using spring + tomcat, ejb3 is rarely needed.

提交回复
热议问题