找不到类型为'org.thymeleaf.TemplateEngine'的bean

时间:2018-07-04 14:46:50

标签: spring-boot thymeleaf autowired

简介

我在POM中使用了以下内容:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
</parent>

AND

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

现在我有以下内容:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.1.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

AND

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

错误:

 Error:(34, 21) java: cannot find symbol
      symbol:   class TemplateProcessingParameters
      location: package org.thymeleaf
    Error:(37, 38) java: package org.thymeleaf.resourceresolver does not exist
    Error:(49, 38) java: cannot find symbol
      symbol:   class TemplateResolver
      location: package org.thymeleaf.templateresolver
    Error:(179, 65) java: cannot find symbol
      symbol:   class IResourceResolver
      location: class eu.europa.ec.themis.sgtemplateservice.MbakTemplateServiceApplication
    Error:(187, 56) java: cannot find symbol
      symbol:   class TemplateProcessingParameters
      location: class org.mbak.MbakTemplateServiceApplication.InMemoryResourceResolver
    Error:(168, 62) java: cannot find symbol
      symbol:   class TemplateResolver
      location: class org.mbak.MbakTemplateServiceApplication

添加了以下依赖项:

我添加了以下内容,并构建了我的应用程序:

<dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf</artifactId>
            <version>2.1.6.RELEASE</version>
        </dependency>

当前错误:

所以现在启动应用程序时出现以下错误:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in org.mbak.MbakServiceApplication$ThymeleafTemplateEngine required a bean of type 'org.thymeleaf.TemplateEngine' that could not be found.


Action:

Consider defining a bean of type 'org.thymeleaf.TemplateEngine' in your configuration.

0 个答案:

没有答案