spring - IoC container property inheritance -
i have number of spring files depend on property placeholders in other files. essentially, have 3 xml files so:
one.xml:
<?xml version="1.0"?> <beans ...> <import resource="two.xml"/> <bean class="org.springframework.beans.factory.config.propertyplaceholderconfigurer"> <property name="locations"> <list> <value>/web-inf/your.properties</value> </list> </property> </bean> <bean id="clasher" class="whatever.clash"> <property name="name" value="${route.one}"/> </bean> </beans> two.xml:
<?xml version="1.0"?> <beans ...> <bean class="org.springframework.beans.factory.config.propertyplaceholderconfigurer"> <property name="locations"> <list> <value>/web-inf/my.properties</value> </list> </property> </bean> </beans> my.properties:
route.one = why not? your.properties:
entirely.unrelated = true i'm getting error looks this:
exception in thread "launcher:/serverling" org.springframework.beans.factory.beandefinitionstoreexception: invalid bean definition name 'clasher' defined in servletcontext resource [/web-inf/one.xml]: not resolve placeholder 'route.one' @ org.springframework.beans.factory.config.propertyplaceholderconfigurer.processproperties(propertyplaceholderconfigurer.java:287) @ org.springframework.beans.factory.config.propertyresourceconfigurer.postprocessbeanfactory(propertyresourceconfigurer.java:75) @ org.springframework.context.support.abstractapplicationcontext.invokebeanfactorypostprocessors(abstractapplicationcontext.java:663) @ org.springframework.context.support.abstractapplicationcontext.invokebeanfactorypostprocessors(abstractapplicationcontext.java:638) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:407) @ org.red5.server.tomcat.tomcatloader$1.run(tomcatloader.java:594) is there way make property placeholders inherit across entire container?
my initial assumption since container didn't care file beans lived in, configure beans run through defined beans in container , use multiple property placeholder configurers fill them in.
why isn't example workingl
set flag propertyplaceholderconfigurer:
<property name="ignoreunresolvableplaceholders" value="true"/>
Comments
Post a Comment