Results 1 to 2 of 2

Thread: PropertyPlaceholderConfigurer and VelocityConfigurer

  1. #1
    Join Date
    Nov 2004
    Posts
    9

    Default PropertyPlaceholderConfigurer and VelocityConfigurer

    Hi,

    I am having problem that placeholders in velocity.properties are not being replaced.

    in applicationContext.xml:
    Code:
    <bean id="propertyPlaceholderConfigurer" class="org.spr...PropertyPlaceholderConfigurer">
      <property name="location"><value>/WEB-INF/app.properties</value></property>
    </bean>
    in some-servlet.xml:
    Code:
    <bean id="velocityConfig"class="org.spr...VelocityConfigurer">
      <property name="configLocation"><value>/WEB-INF/velocity.properties</value></property>
    </bean>
    /WEB-INF/app.properties:
    Code:
    velocity.file.resource.loader.modificationCheckInterval=0
    /WEB-INF/velocity.properties:
    Code:
    file.resource.loader.modificationCheckInterval=$&#123;velocity.file.resource.loader.modificationCheckInterval&#125;
    The place holder ${velocity.file.resource.loader.modificationCheckI nterval} was not replaced by 0 (got exception from VelocityConfig trying to convert that ${ve...} string to a number)

    I have tried a few things without success:

    1. move the PropertyPlaceholderConfigurer from applicationContext.xml to some-servlet.xml

    2. use a PropertiesFactoryBean instead of setting the configLocation on VelocityConfigurer (same result):
    Code:
    <bean id="velocityConfig"class="org.spr...VelocityConfigurer">
      <property name="velocityProperties">
        <bean class="org.spr...PropertiesFactoryBean">
          <property name="location">/WEB-INF/velocity.properties</property>
        </bean>
      </property>
    </bean>
    any help ?

    thanx.

    -cs

  2. #2
    Join Date
    Aug 2004
    Location
    Toulouse, France
    Posts
    148

    Default

    The PropertyPlaceholderConfigurer is meant to use variables instead of property values in the same app context. So, it doesn't change the value of a file included to be interpreted by a bean.
    However, you can dispatch toward one velocity configuration or another, it is the right level of abstraction.

    HTH

    Olivier

Posting Permissions

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