此規則會標示
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 中共用資源連線的相關資訊,請參閱不能共用和可共用的連線。