Java Spring-applicationContext.xml中的路径
我在applicationContext.xml中定义了一个freemarker bean,这个bean需要到我的模板目录的路径。 过去是:Java Spring-applicationContext.xml中的路径,java,spring,Java,Spring,我在applicationContext.xml中定义了一个freemarker bean,这个bean需要到我的模板目录的路径。 过去是: src/main/webapp/template/ 但我现在想将模板存储在以下位置: src/main/resources/template/ 它过去看起来像: <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerCo
src/main/webapp/template/
但我现在想将模板存储在以下位置:
src/main/resources/template/
它过去看起来像:
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="/template/email/"/>
</bean>
有人能帮我正确定义新路径吗?回答正确,这样你就可以结束问题了 您应该使用“classpath:”前缀来引用位于类路径中的资源
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="classpath:/template/email/"/>
</bean>
是的,确实如此!:)谢谢你的回复!