Results 1 to 4 of 4

Thread: Spring 3.1m1 context:property-placeholder do not resolve properties

  1. #1
    Join Date
    Jan 2010
    Posts
    2

    Default Spring 3.1m1 context:property-placeholder do not resolve properties

    Code:
    <context:property-placeholder location="classpath*:config.properties" ignore-unresolvable="true" />
    
    <bean id="springContext" class="${basePackage}.common.SpringContext"/>
    
    <context:component-scan base-package="${basePackage}.service" />

    The property basePackage is not resolved in "springContext" bean but in component-scan is resolved.

    the exception is:

    Code:
     java.io.FileNotFoundException: class path resource [${basePackage}/common/SpringContext.class] cannot be opened because it does not exist


    Thanks

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,791

    Default

    First time I see something about this directly in the XML file, in this way

    To be honest I dont know if should work but ..

    Have you read something similiar on Spring Documentation?
    or
    Are you assuming should work?

    Consider read about SpEL
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    12

    Default

    hi lascarayf ,

    To the best of my knowledge bean definitions are first loaded followed by the invokation of BeanFactoryPostProcessors. PropertyPlaceholderConfigurer (what u defined in your xml) is a BeanFactoryPostProcessor. So your PropertyPlaceholderConfigurer is not yet called by the time the an attempt is made to load the bean definition.
    Thats the way I see it (IMHO)
    T-Okwen

  4. #4
    Join Date
    Nov 2010
    Posts
    10

    Default

    Hello,

    Let me continue this post,

    I have this conf :

    <bean class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="locations">
    <list>
    <value>classpath:config.properties</value>
    </list>
    </property>
    </bean>
    next I have configured another bean witch some properties should be initialized by the data loacted in the property file conf.properties
    <bean id="dataSourceConfig" class="com.tuto.maven.dao.conf.DataSourceConfig">
    <property name="dataPath" value="${data.store.path}"/>
    <property name="productStoreName" value="${product.store.name}"/>
    <property name="supplierStoreName" value="${supplier.store.name}"/>
    <property name="storeExtension" value="${data.store.extension}"/>
    </bean>
    The problem is, I stil getting key instead of getting the value of this key

    what I should do for resolving this problem?

    Thanks

Tags for this Thread

Posting Permissions

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