![](/img/trans.png)
[英]Spring MessageSource: access message file within dependency jar
[英]Access a properties file within a dependency jar in a war tomcat via classpath Spring
讓A成為我基於jar Maven的核心項目類。 W是我在另一個項目中的戰爭。 我已將A添加為對W的依賴項。我已將prop.properties文件存儲在資源文件夾中的A中。 在我的戰爭中,如何使用類路徑從jar訪問屬性文件。 使用Spring4。我用以下命令更新了jar的spring.xml:
<context:property-placeholder
location="classpath:prop.properties" ignore-unresolvable="true"/>
在classpath
之后使用Asterisk ,這將告訴spring在classpath
中所有添加的依賴項中尋找配置:
<context:property-placeholder
location="classpath*:prop.properties" ignore-unresolvable="true"/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.