Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.1m1 context:property-placeholder do not resolve properties Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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

      Comment


      • #4
        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

        Comment

        Working...
        X