What is an Enterprise Java Bean really?

前端 未结 7 1865
小鲜肉
小鲜肉 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:02

    An EJB implementation would be a bean written and packaged to run on any compliant EJB server. If you do what you describe, it may work, but it won't be portable to another vendor's application server.

    So EJB is a standard that adheres to a specific specification and is therefore portable.

    In practice many EJB's are not fully compliant or application server neutral. However, in the main they are, so the small incompatibilities would be much easier to fix if you changed application server vendors than attempting to move the architecture you described to a GlassFish, JBoss or Weblogic server.

    EDIT: In response to your comment you would not have an EJB appropriately annotated and/or configured via XML in such a way that code that accessed it in EJB compliant ways would be able to use it without changes.

    There are two angles to your comment. One is what functionality would you lose deploying on a JBoss or any of the others instead of Tomcat? Likely nothing, if you brought along all of the frameworks you relied on. However, if you wanted to move your code to Weblogic, for example, to use some of its features, then your code would need some likely significant changes to keep up.

    I am not saying that you cannot replicate all EJB functionality (certainly the subset you care about) via other means, just that it is not the spec, and therefore not implementation independent.

提交回复
热议问题