Spring 如何使用PropertyPlaceHolderConfigure从另一个xml文件中的pom文件中读取?
我想使用PropertyPlaceHolderConfigure从applicationContext.xml文件内的pom文件中读取,如下所示:Spring 如何使用PropertyPlaceHolderConfigure从另一个xml文件中的pom文件中读取?,spring,maven,applicationcontext,Spring,Maven,Applicationcontext,我想使用PropertyPlaceHolderConfigure从applicationContext.xml文件内的pom文件中读取,如下所示: <context:component-scan base-package="${project.groupId}"/> 考虑到pom文件具有以下内容: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/X
<context:component-scan base-package="${project.groupId}"/>
考虑到pom文件具有以下内容:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myapp</groupId>
以下是PropertyPlaceHolderConfigure配置:
问题:PropertyPlaceHolderConfigure无法替换applicationContext.xml中的值
请建议如何让它工作。谢谢。发现问题,applicationContext位于src/main/webapp/WEB-INF下,但必须位于src/main/resources下才能工作
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:oauth_consumer.properties</value>
<value>classpath:application.properties</value>
</list>
</property>
</bean>