开发者社区> 问答> 正文

关于FreeMarkerViewResolver的配置

<bean class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
  <property name="templateLoaderpaths" value="/WebContent/jsp/"></property>
    <property name="defaultEncoding" value="utf-8"></property>
    <property name="freemarkerSettings">
        <props>
            <prop key="locale">zh_CN</prop>
        </props>
    </property>
</bean>
<bean class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
    <property name="suffix" value=".*"></property>
    <property name="contentType" value="text/html;charset=utf-8"></property>
    <property name="requestContextAttributes" value="request" />
    <property name="exposeRequestAttributes" value="true" />
    <property name="exposeSessionAttributes" value="true" /> 
</bean>

org.springframework.beans.NotWritablePropertyException: Invalid property 'templateLoaderpaths' of bean class [org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer]: Bean property 'templateLoaderpaths' is not writable or has an invalid setter method. Did you mean 'templateLoaderPath', or 'templateLoaderPaths'?at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1064)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:924)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
... 31 more

展开
收起
蛮大人123 2016-03-12 15:48:02 3210 0
1 条回答
写回答
取消 提交回答
  • 我说我不帅他们就打我,还说我虚伪

    templateLoaderpaths这个bean的名称不对,改成这个试试templateLoaderPaths

    2019-07-17 19:01:05
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载