A.4. jboss-ejb3.xml Deployment Descriptor Reference
jboss-ejb3.xml 是一种自定义部署描述符,可用于 Jakarta Enterprise Beans JAR 或 WAR 存档。在 Jakarta Enterprise Beans JAR 存档中,它必须位于 META-INF/ 目录中。在 WAR 存档中,它必须位于 WEB-INF/ 目录中。
格式与 ejb-jar.xml 类似,使用一些相同的命名空间并提供其他一些命名空间。jboss-ejb3.xml 的内容与 ejb-jar.xml 的内容合并,优先 为 jboss-ejb3.xml 项目。
本文档仅涵盖 jboss-ejb3.xml 使用的其他非标准命名空间。有关标准命名空间的文档,请参阅 http://xmlns.jcp.org/xml/ns/javaee/。
root 命名空间是 http://xmlns.jcp.org/xml/ns/javaee。
- 观察描述符命名空间
-
以下命名空间都可以在
<assembly-descriptor>元素中使用。它们可用于将其配置应用到单个 Bean,或使用通配符(*)作为ejb-name应用到部署中的所有 bean。 - 安全命名空间(
urn:security) xmlns:s="urn:security"
这允许您为 Jakarta Enterprise Beans 设置
security。-domain和 run-as-principal<s:security> <ejb-name>*</ejb-name> <s:security-domain>myDomain</s:security-domain> <s:run-as-principal>myPrincipal</s:run-as-principal> </s:security>
- 资源适配器命名空间:
urn:resource-adapter-binding xmlns:r="urn:resource-adapter-binding"
这可让您为 Message-Driven Bean 设置资源适配器。
<r:resource-adapter-binding> <ejb-name>*</ejb-name> <r:resource-adapter-name>myResourceAdapter</r:resource-adapter-name> </r:resource-adapter-binding>
- IIOP namespace:
urn:iiop xmlns:u="urn:iiop"
IIOP 命名空间是配置 IIOP 设置的位置。
- 池 namespace:
urn:ejb-pool:1.0 xmlns:p="urn:ejb-pool:1.0"
这允许您选择由包含无状态会话 Bean 或 Message-Driven Beans 使用的池。池在服务器配置中定义。
<p:pool> <ejb-name>*</ejb-name> <p:bean-instance-pool-ref>my-pool</p:bean-instance-pool-ref> </p:pool>
- cache namespace:
urn:ejb-cache:1.0 xmlns:c="urn:ejb-cache:1.0"
这可让您选择所含有状态会话 Bean 使用的缓存。缓存在服务器配置中定义。
<c:cache> <ejb-name>*</ejb-name> <c:cache-ref>my-cache</c:cache-ref> </c:cache>
<?xml version="1.1" encoding="UTF-8"?> <jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd" version="3.1" impl-version="2.0"> <enterprise-beans> <message-driven> <ejb-name>ReplyingMDB</ejb-name> <ejb-class>org.jboss.as.test.integration.ejb.mdb.messagedestination.ReplyingMDB</ejb-class> <activation-config> <activation-config-property> <activation-config-property-name>destination</activation-config-property-name> <activation-config-property-value>java:jboss/mdbtest/messageDestinationQueue </activation-config-property-value> </activation-config-property> </activation-config> </message-driven> </enterprise-beans> </jboss:ejb-jar>注意jboss-ejb3-spec-2_0.xsd文件存在已知问题,可能会导致架构验证错误。您可以忽略这些错误。如需更多信息,请参阅 https://bugzilla.redhat.com/show_bug.cgi?id=1192591。