Failed to instantiate [org.thymeleaf.templateresolver.ServletContextTemplateResolver]: No default constructor found

后端 未结 2 1143
情书的邮戳
情书的邮戳 2021-01-03 07:39

I want to integrate Spring 4 with Thymeleaf, but I got:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name \'templateReso         


        
2条回答
  •  日久生厌
    2021-01-03 08:06

    Short
    Replace ThymeleafViewResolver with SpringResourceTemplateResolver:

    
    
    

    Long
    Few days ago I had the same problem when used Tutorial: Thymeleaf + Spring, it is a bit outdated. Solution was found at "Thymeleaf 3 ten-minute migration guide":

    The first difference with the Thymeleaf 2 configuration is that now the recommended template resolver for Spring applications is SpringResourceTemplateResolver

提交回复
热议问题