1、准备数据库环境,在MySQL数据库中,创建一个名为microservice的数据库,在microservice中创建表tb_user,并在表中插入3条数据;

pring Boot与MyBatista的集成

2、创建项目,添加依赖。

pring Boot与MyBatista的集成

3、编写配置文件,在application.properties中添加数据库配置信息以及日志信息。

pring Boot与MyBatista的集成

4、创建实体类User。

pring Boot与MyBatista的集成

5、编写mapper。

pring Boot与MyBatista的集成

6、编写service类

 6.1、编写接口,创建接口文件UserService

pring Boot与MyBatista的集成

 6.2、编写实现类,创建UserService接口的实现类UserServiceImpl

pring Boot与MyBatista的集成

7、编写Controller,创建用户控制器类UserController;

pring Boot与MyBatista的集成

8、实现前端页面,创建页面文件user.html

pring Boot与MyBatista的集成

9、启动项目,查看结果;

pring Boot与MyBatista的集成

相关文章:

  • 2021-06-07
  • 2021-06-13
  • 2021-05-09
  • 2021-09-30
  • 2022-01-03
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-07
  • 2022-01-24
  • 2021-11-22
  • 2021-08-09
  • 2021-09-18
相关资源
相似解决方案