关于创建Spring boot 项目,以Thymeleaf为依赖,运行时报错


创建一个新的Springboot项目,并且只以Thymeleaf为依赖。



直接运行启动类时,启动时报错,log如下:


一直找不到原因,因为选择Thymeleaf依赖,spring-boot-started-thymeleaf会自动包含spring-boot-started-web。

在启动类中添加一个方法时:


发现@RequestMapping报错,并且不能导入相应的类。结合网上大神的指点,发现:少了一个Spring-boot-starter-web依赖。


加上Spring-boot-starter-web的依赖,问题得以解决。

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

猜你喜欢

转载自blog.csdn.net/qq_26817225/article/details/80490574
今日推荐