在 Lite 容器中,EJB 是否只打包在 war 中 运行?

Do EJB's packaged inside a war only run in the Lite container?

我最近阅读了 EJB in Action 并且无意中发现了这段文字:

The Java EE 6 specification allows for session and message-driven beans to be included
inside a WAR module instead of having to deploy them separately in an EJB-JAR module.
When included in a WAR module, the beans run in the EJB Lite container.

如果 When included in a WAR module, the beans run in the EJB Lite container. 为真,我在规范中找不到任何信息。

EJB 也可以打包在完整的 ejb 容器中的 .war 运行 中,或者它们是否严格限于 Lite 版本。欢迎任何有关此事的消息来源:)

The Java EE 6 specification allows for session and message-driven beans to be included inside a WAR ...

这只是部分正确! message-driven beans 根据 EJB 3.1 specification(参见 第 21.1 章:EJB Lite,提取并显示在下面):

21.1 EJB 3.1 Lite

The EJB API is comprised of a large feature set with support for implementing business logic in a wide variety of enterprise applications. However, the full range of API contracts is not always crucial for all runtime environments. In addition, the breadth of the full API can present challenges for developers just getting started with Enterprise JavaBeans technology.

For these reasons this specification defines a minimal subset of the EJB API known as EJB 3.1 Lite. EJB 3.1 Lite is not a product. Rather, it is a proper subset of the full EJB 3.1 API that includes a small,powerful selection of EJB features suitable for writing portable transactional business logic. The defini- tion of EJB 3.1 Lite gives vendors an option to implement only a portable subset of the EJB API within their product. The vastly reduced size of the feature set makes it suitable for inclusion in a wider range of Java products, many of which have much smaller installation and runtime footprints than a typical full Java EE implementation.

An EJB 3.1 Lite application is merely an EJB application whose EJB API usage falls within the EJB Lite subset. There are no special APIs defined only for EJB 3.1 Lite. Therefore, any EJB 3.1 Lite application can be deployed on any Java EE product that implements Enterprise JavaBeans technology,whether that product supports EJB 3.1 Lite or the full EJB API.

As detailed in Table 27, the EJB 3.1 Lite API is composed of the following subset of the EJB API :

  • Stateless, Stateful, and Singleton Session Bean components
  • Local and no-interface view only
  • Synchronous method invocations only
  • Container-managed transactions / Bean-managed transactions
  • Declarative and programmatic Security
  • Interceptors
  • Deployment Descriptor support (ejb-jar.xml)

你的问题的答案

So can EJB's packaged inside a .war run in the full ejb container or are they strictly restricted to the Lite version.

规范也给出了答案:请参阅上面摘录中的粗体部分。 Java EE 6 Web 配置文件需要支持 .war 文件,该文件也是完整配置文件的一部分。

您可以在以下位置找到更多信息: