Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 如何使用PropertyPlaceHolderConfigure从另一个xml文件中的pom文件中读取?_Spring_Maven_Applicationcontext - Fatal编程技术网

Spring 如何使用PropertyPlaceHolderConfigure从另一个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

我想使用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/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>