小编典典

通过类路径Spring访问war Tomcat中的依赖项jar中的属性文件

tomcat

让A成为我基于jar
Maven的核心项目类。W是我在另一个项目中的战争。我已将A添加为对W的依赖项。我已将prop.properties文件存储在资源文件夹中的A中。在我的战争中,如何使用
类路径 从jar访问属性文件。使用Spring4。我用以下命令更新了jar的spring.xml:

 <context:property-placeholder 
 location="classpath:prop.properties" ignore-unresolvable="true"/>

阅读 206

收藏
2020-06-16

共1个答案

小编典典

之后使用Asteriskclasspath这将告诉Spring在类路径中所有已添加的依赖项中寻找配置:

<context:property-placeholder 
 location="classpath*:prop.properties" ignore-unresolvable="true"/>
2020-06-16