我只是想知道你何时/为什么要在web.xml文件中定义resource-ref元素?
我原本以为它会在您的web/app服务器中使用JNDI定义,然后在Java代码中查找JNDI引用?
资源引用定义对我来说似乎有点多余,我无法想到什么时候它可能有用.例:
<resource-ref>
<description>Primary database</description>
<res-ref-name>jdbc/primaryDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>CONTAINER</res-auth>
</resource-ref>
Run Code Online (Sandbox Code Playgroud)