项目结构:

pom.xml
<dependencies>
<!--springboot官方的启动器:spring-boot-start-XXX -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--整合mybatis启动器:mybatis-spring-boot-starter -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

本文介绍了一个使用SpringBoot、Druid数据源和Mybatis的项目配置。项目中,配置文件application.yml设置了Druid的相关参数,UserController实现用户操作,UserService提供业务逻辑,UserMapper处理数据访问,User类定义了实体结构,UserMapper.xml包含SQL映射。此外,DruidConfig用于定制Druid的监控和连接池设置。
最低0.47元/天 解锁文章
1372

被折叠的 条评论
为什么被折叠?



