我希望 Spring 首先检查 JBoss EAP 6.2(使用 JBoss AS 7.2)中的系统属性,然后检查位于 jar 内的属性。
我试过了
<context:property-placeholder location="classpath:xxx.properties" />
但这使用 jar 中的属性而不是 JBoss 的系统属性。 我也尝试过
<context:property-placeholder location="classpath:xxx.properties" system-properties-mode="OVERRIDE" />
这应该使用旧的 PropertyPlaceholderConfigurer,但这也仍然使用 jar 中的属性。我还尝试设置 3.0(而不是 3.2)spring xsd 但无济于事。
那么如何让Spring先检查JBoss中的属性,然后再检查jar中的属性呢?
编辑:我尝试用其他选项(ENVIRONMENT、NEVER 和 FALLBACK)替换 OVERRIDE,但最终总是得到本地属性中定义的值。
最佳答案
在 Artem Bilan 发表评论后,我再次搜索(只是为了确保没有重复项),并找到了一个加载相同属性的类,但在 Java 中(Properties.load()
)。这会导致覆盖我试图通过 Spring 加载的系统属性
。
关于java - Spring 3.2 PropertySourcesPlaceholderConfigurer 与 JBoss EAP 6.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22914888/