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

此规则将标记 resource-ref WEB-INF/web.xml 文件中找到的元素缺少 res-sharing-scope 元素。 Apache Tomcat 服务器将资源共享作用域缺省为 Shareable . 资源共享范围在 Java EE 中被定义为可选属性。 将提供自动修复 以在 WebSphere 传统和 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