【发布时间】:2019-01-26 04:58:10
【问题描述】:
我有一个 Web 应用程序,其中我在 web.xml 中定义了 3 个 jndi 资源 1个用于数据库,2个用于动态缓存
如何在 Spring boot 中将其转换为 Java 配置。
以下是应用程序中的示例资源引用配置
<resource-ref>
<description>Resource reference for database</description>
<res-ref-name>jdbc/dbname</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref id="cache1">
<description>cache1 description</description>
<res-ref-name>cache/cache1</res-ref-name>
<res-type>com.ibm.websphere.cache.DistributedMap</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref id="cache2">
<description>cache2 description</description>
<res-ref-name>cache/cache2</res-ref-name>
<res-type>com.ibm.websphere.cache.DistributedMap</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
谢谢
【问题讨论】:
-
我是 Spring 用户,但不是 Spring Boot。你使用什么样的 Spring 配置?是 XML 文件,还是只是基于注释的配置?
-
目前它是一个带有 web.xml 的 spring mvc 应用程序。我想将应用程序移动到 Spring boot 并将配置转换为基于 java 的注释。
-
您是否尝试过使用
@Resource(name="jdbc/dbname")? -
你必须把它们放在一个
ibm-web-bnd.xml文件中。 -
Spring Boot 和嵌入式服务器仅支持 Tomcat、Jetty 和 Undertow。你打算从 WebSphere 迁移到以上任何一个吗?
标签: spring-boot websphere