Announcement Announcement Module
Collapse
No announcement yet.
How to turn off caching of velocity templates? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to turn off caching of velocity templates?

    Hi. Is it possible to disable caching of velocity templates? Here are the configuration settings i've tried:

    Code:
    <bean id="velocityConfigurer" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
        <property name="resourceLoaderPath" value="WEB-INF/views/" />
        <property name="velocityProperties">
            <props>
                <prop key="file.resource.loader.cache">false</prop>
                <prop key="springMacro.resource.loader.cache">false</prop>
                <prop key="velocimacro.library.autoreload">true</prop>
                ...
        </property>
    </bean>
    "springMacro" is the name of the resource loader for the bind macros. "file" is the name of the resource loader VelocityEngineFactory tells the velocity engine to use for templates in resourceLoaderPath if preferFileSystemAccess is true (which is is by default).

    Code:
    <bean id="viewResolver" class="no.bbs.nettbutikk.spring.VelocityToolboxViewResolver">
        <property name="cache" value="false" />
        <property name="exposeSpringMacroHelpers" value="true" />
        <property name="suffix" value=".vm" />
        <property name="contentType" value="text/html; charset=ISO-8859-1" />
        <property name="toolboxConfigLocation" value="/WEB-INF/velocitytoolbox.xml" />
        <property name="requestContextAttribute" value="rc" />
    </bean>
    VelocityToolboxViewResolver is a subclass of org.springframework.web.servlet.view.velocity.Velo cityViewResolver.

    Velocity 1.4, Spring 1.2 rc 1.

  • #2
    you may need to call
    Code:
    setCacheTemplate&#40;false&#41;;
    on the VelocityView itself.

    Regards,

    Comment


    • #3
      Thanks, but it doesn't seem to make any difference.

      Comment

      Working...
      X