views:

224

answers:

1

How do you configure Spring 3 to use a custom object wrapper to use with FreeMarker?

I've created a custom object wrapper for FreeMarker but I'm not sure how you configure Spring 3 to use the wrapper. The following has no effect:

    <bean id="freemarkerConfig"
          class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
        <property name="templateLoaderPath" value="/WEB-INF/classes/templates/"/>
        <property name="freemarkerSettings">
            <props>
                <prop key="object_wrapper">my.custom.ObjectWrapper</prop>
            </props>
        </property>
    </bean>

Any pointers appreciated.

A: 

FreemarkerView auto-detects the FreeMarkerConfigurer bean in the context, and gets the config from that. Obviously, you have to be using FreemarkerView correctly in order for this to work, but you haven't told us anything about how you're using freemarker.

skaffman