【问题标题】:spring mvc 4 + thymeleaf春天 mvc 4 + thymeleaf
【发布时间】:2015-10-21 14:50:49
【问题描述】:

thymeleaf 是新的,并试图将其集成到 spring mvc 4 中。

按照this教程我遇到了这个问题:

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.thymeleaf.templateresolver.ServletContextTemplateResolver]for bean with name 'templateResolver' defined in ServletContext resource [/WEB-INF/spring-mvc-config.xml];

现在我确定您拥有所有必要的罐子,这取决于什么? 附上配置文件。

spring-mvc-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/mvc
                           http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
                           http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                           http://www.springframework.org/schema/context
                           http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <context:component-scan base-package="it.shakesoft.common.controller" />


 <bean id="templateResolver"
        class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
    <property name="prefix" value="/WEB-INF/view/" />
    <property name="suffix" value=".html" />
    <property name="templateMode" value="HTML5" />
  </bean>

  <bean id="templateEngine"
        class="org.thymeleaf.spring4.SpringTemplateEngine">
    <property name="templateResolver" ref="templateResolver" />
  </bean>

  <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
    <property name="templateEngine" ref="templateEngine" />
  </bean>

</beans>

【问题讨论】:

标签: java spring-mvc thymeleaf


【解决方案1】:

问题是缺少 jar of thymeleaf,我只加载到 spring mvc 4。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-24
    • 2014-02-25
    • 2015-02-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多