Results 1 to 3 of 3

Thread: Two PropertyPlaceholderConfigurer defined in two conext files not loaded properly

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    232

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Nov 2008
    Posts
    232

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •