Announcement Announcement Module
Collapse
No announcement yet.
PropertyPlaceholderConfigurer and VelocityConfigurer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment

    Working...
    X