changes to the speed model to reflect without restarting the server

advertisements

Is there any way to make the changes made in vm file to reflect automatically without restarting the server everytime. I am in development phase right now and i have quite a few changes to be done. I am new to velocity template and hence it will be highly helpful If someone could suggest a way for the same. I tried using the following properties but it doesn't work.I am using tomcat server.

<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
 <property name="velocityProperties">
        <value>
            resource.loader=class
           class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
            velocimacro.library.autoreload=true
            class.resource.loader.cache=false
            velocimacro.permissions.allow.inline.to.replace.global=true
        </value>
    </property>
</bean>


If my understanding is correct, you are trying to hot deploy your velocity template (vm extension) on your server. If we refer at the documentation, you should rather go for the "file" oriented properties.

<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
 <property name="velocityProperties">
        <value>
            resource.loader=file
            file.resource.loader.class=org.apache.velocity.runtime.resource.loader.FileResourceLoader
            velocimacro.library.autoreload=true
            file.resource.loader.cache=true
            file.resource.loader.path=/WEB-INF/views
            velocimacro.permissions.allow.inline.to.replace.global=true
            file.resource.loader.modificationCheckInterval=2
        </value>
    </property>
</bean>

Make sure that your views path is correct (file.resource.loader.path). I added file.resource.loader.modificationCheckInterval because as you are caching the templates, you should give the number of seconds between two checks.