让 A 成为我基于核心 jar maven 的项目类。 W 是我在另一个项目中的 war 。我已将 A 添加为我对 W 的依赖项。我已将我的 prop.properties 文件存储在资源文件夹中的 A 中。我如何在我的 war 中使用 classpath 从 jar 访问属性文件。使用 Spring 4。 我已经用以下内容更新了 jar 的 spring.xml:
<context:property-placeholder
location="classpath:prop.properties" ignore-unresolvable="true"/>
最佳答案
使用Asterisk在 classpath
之后,这将告诉 spring 在类路径中的所有添加的依赖项中查找配置:
<context:property-placeholder
location="classpath*:prop.properties" ignore-unresolvable="true"/>
关于java - 通过类路径 Spring 访问 war tomcat 中依赖项 jar 中的属性文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38739690/