【发布时间】:2017-09-21 00:08:48
【问题描述】:
我正在做一个使用 SpringBoot 1.4.3-RELEASE 开发的项目。
根据公司内部文件,需要我们在WEB-INF/web.xml中定义一个,每个应用。示例如下:
<resource-ref>
<res-ref-name>connectivityConfiguration</res-ref-name>
<res-type>com.hide-my-company-name.ConnectivityConfiguration</res-type>
</resource-ref>
然后使用JNDI查找来获取某个对象。但是我没有WEB-INF/web.xml。
因此,我在本地 tomcat context.xml 中定义资源,而不是 WEB-INF/web.xml。
<Context>
<Resource name="connectivityConfiguration"
type="com.hide-my-company-name.ConnectivityConfiguration" />
</Context>
它有效。但是,仅在我的本地开发环境中。 因为部署后我无法更改“context.xml”或“server.xml”。
问题: 有没有其他方法可以使用 SpringBoot 定义相同的资源?例如。通过。 Java 代码,还是通过 application.properties?
【问题讨论】:
标签: spring-boot jndi servlet-3.0