1
我有2个基于spring的jar文件 - parent.jar和child.jar。在依赖jar中的spring appContext.xml无法加载属性文件。
parent.jar有parent_applicationContext.xml和它加载如下
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:app.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>
<bean id="appBean" class="com.foo.App" >
<property name="appName" value="${app.name}" />
</bean>
child.jar包括parent.jar的依赖,并有自己的applicationContext.xml属性文件。 但是,当我执行child.jar时,我无法看到parent_applicationContext.xml能够加载app.properties。
我看到错误消息
Invalid bean definition with name 'appBean' defined in class path resource [parent_applicationContext.xml]: Could not resolve placeholder 'app.name'
任何线索?