我最近阅读了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.
如果 包含在 WAR 模块中时,bean 在 EJB Lite 容器中运行。
为真,我无法在规范中找到任何信息。
因此,打包在 .war
中的 EJB 是否可以在完整的 ejb 容器中运行,或者它们是否严格限于 Lite 版本。欢迎任何有关此事的消息来源:)
最佳答案
The Java EE 6 specification allows for session and message-driven beans to be included inside a WAR ...
这只是部分正确!根据 EJB 3.1 specification,消息驱动的 bean
绝对不是 EJB lite 的一部分。 (请参阅下面提取和显示的第 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
文件,该文件也是完整配置文件的一部分。
您可以在以下位置找到更多信息:
关于java - 打包在 war 中的 EJB 是否只在 Lite 容器中运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39453968/