Announcement Announcement Module
Collapse
No announcement yet.
Two PropertyPlaceholderConfigurer defined in two conext files not loaded properly Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Two PropertyPlaceholderConfigurer defined in two conext files not loaded properly

    My application context has several context.xml .

    context.xml
    contextTwo.xml

    Each context file has bean definations and a PPC defined to replace some properties from seperate properties files

    context.xml
    Code:
    	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="locations">
    			<list>
            		<value>classpath:default.properties</value>
            	</list>
    		</property>
    	</bean>
    	
    	<bean id="initBean" class="com.xyz.init.Init" init-method="init">
    		<property name="message" value="${message}"></property>
    		<property name="service" ref="myService"></property>
    	</bean>
    contextTwo.xml
    Code:
    	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="locations">
    			<list>
            		<value>classpath:defaultTwo.properties</value>
    			</list>
    		</property>
    	</bean>
    	
    	<bean id="initTwoBean" class="com.xyz.init.InitTwo" init-method="init">
    		<property name="message" value="${messageTwo}"></property>
    		<property name="service" ref="myService"></property>
    	</bean>
    On bundle deployment it is giving
    [ERROR]
    rce.kernel.deployer.core.DeploymentException: Invalid bean definition with name 'initTwoBean' defined in URL [bundleentry://62.fwk19194
    373/META-INF/spring/module-contextTwo.xml]: Could not resolve placeholder 'messageTwo'
    [/ERROR]

  • #2
    I suggest the search this question has been answered numerous times before.

    1) You have not named your beans, i.e. they override each other
    2) If you use multiple PPC they all have to use different placeholders.

    Comment


    • #3
      Thanks Marten
      I found the solution
      <property name="ignoreUnresolvablePlaceholders" value="true"/>

      Comment

      Working...
      X