spring boot 四层搭建

2.构建的是springboot+mybatis,所以在目录Java下的service只提供接口,在resources下要创建和Java相同目录的dao文件夹

spring boot 四层搭建

3.在pom.xml中添加thymeleaf模板依赖
 
<!--加载thymeleaf模板依赖-->
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

 

遇到的问题:
1.启动springboot时,下面报错,有可能是添加的依赖冲突
 
spring boot 四层搭建
具体原因是:
将Tomcat的依赖注解掉,因为web依赖中已经包括Tomcat
解决办法

 spring boot 四层搭建

2.编写的controller无法扫描不到

spring boot 四层搭建

解决办法:
在入口程序@SpringBootApplication后加扫描的路径(scanBasePackages = "com")

spring boot 四层搭建

 

spring boot 四层搭建

相关文章:

  • 2021-05-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-11-14
猜你喜欢
  • 2021-11-12
  • 2021-12-15
  • 2021-12-08
  • 2021-10-11
  • 2021-06-01
  • 2021-10-17
  • 2021-12-02
相关资源
相似解决方案