此规则会标记在 WEB-INF/web.xml 文件中找到的缺少 res-sharing-scope 元素的 resource-ref 元素。 Apache Tomcat 服务器会将资源共享作用域缺省值设为 Shareable。 资源共享作用域定义为 Java EE 中的可选属性。 在源扫描程序中,为此规则提供了快速修订。 您可以使用该快速修订,以便在 WebSphere Traditional 和 Liberty 中获取与 Tomcat 中相同的可共享作用域。
该快速修订会添加 res-sharing-scope 元素(如果尚未设置),并将连接定义为 Shareable。
这里举例说明了会进行标记的资源引用:|
<resource-ref> <description> Example Database</description> <res-ref-name>jdbc/exampleDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> |
|
<resource-ref> <description> Example Database</description> <res-ref-name>jdbc/exampleDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> |
有关在 WebSphere Application Server 中共享资源连接的更多信息,请参阅 Unshareable and shareable connections。