在资源引用上设置共享作用域

此规则将标记 resource-ref WEB-INF/web.xml 文件中找到的元素缺少 res-sharing-scope 元素。 Apache Tomcat 服务器将资源共享作用域缺省为 Shareable 我不知道 资源共享作用域在 Java EE中定义为可选属性。 在源扫描程序中,为此规则提供了快速修订。 您可以使用该快速修订,以便在 WebSphere Traditional 和 Liberty 中获取与 Tomcat 中相同的可共享作用域。

快速修订会添加 res-sharing-scope 元素 (如果尚未设置) ,并将连接定义为 Shareable .

这里举例说明了会进行标记的资源引用:
<resource-ref>
<description>
示例数据库</description>
<res-ref-name>jdbc/exampleDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>容器</res-auth>
</resource-ref>


该快速修订会添加 res-sharing-scope 元素:
<resource-ref>
<description>
示例数据库</description>
<res-ref-name>jdbc/exampleDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>容器</res-auth>
<res-sharing-scope>可共享</res-sharing-scope>
</resource-ref>

有关在 WebSphere Application Server 中共享资源连接的更多信息,请参阅 Unshareable and shareable connections