0

Having the file \WEB-INF\application.properties, with the properties:

templateName = templateName

I just defined the bean

<bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
            <property name="locations">
                <list><value>classpath:application.properties</value></list>
            </property> 
</bean>

expose it to the ViewResolver:

<!-- Resolves view name to template & body -->
    <bean name="templateViewResolver" class="springext.web.servlet.mvc.support.TemplateViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="templateMap">
            <bean class="springext.web.servlet.mvc.support.TemplateMapFactory">
                <property name="templateDir" value="/WEB-INF/jsp/template/" />
                <property name="templateSuffix" value="Template.jsp" />
                <property name="bodySuffix" value="Body.jsp" />
            </bean>
        </property>
        <property name="exposedContextBeanNames">
            <list><value>applicationProperties</value></list>
        </property>
    </bean>

the property does not show up in a jsp using

${applicationProperties.templateName} 

1 Answers1

0

The problem is that if you place your application.properties inside \WEB-INF\application.properties it won't be available on classpath, which will scan from /WEB-INF/classes. Place it inside /src/main/resources and it should work for you

Master Slave
  • 27,771
  • 4
  • 57
  • 55