怎么在SpringBoot中利用Mybatis& Mybatis-plus映射文件

  介绍

本篇文章为大家展示了怎么在SpringBoot中利用Mybatis& Mybatis-plus映射文件,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

SpringBoot是什么

SpringBoot一种全新的编程规范,其设计目的是用来简化新弹簧应用的初始搭建以及开发过程,SpringBoot也是一个服务于框架的框架,服务范围是简化配置文件。

1,使用Mybatis

& lt; dependency>   ,,& lt; groupId> org.mybatis.spring.boot   ,,& lt; artifactId> mybatis-spring-boot-starter   ,,& lt; version> 1.3.2   & lt;/dependency>

yml文件配置的mapper映射及相关信息格式:

mybatis:   ,,mapper-locations:类路径:mybatis/映射器/* . xml   config-locations才能:类路径:mybatis/mybatis-config.xml   type-aliases-package才能:com.ausclouds.bdbsec。实体

2,使用Mybatis-Plus

, & lt; dependency>   ,,,,,,,,,,,& lt; groupId> com.baomidou   ,,,,,,,,,,,& lt; artifactId> mybatis-plus-boot-starter   ,,,,,,,,,,,& lt; version> 3.2.0   ,& lt;/dependency>

yml文件配置的mapper映射及相关信息格式:

mybatis-plus:   ,,mapper-locations:类路径:mybatis/映射器/* . xml   config-locations才能:类路径:mybatis/mybatis-config.xml   type-aliases-package才能:com.example.demo.entity

3,其他

加上@Slf4j注解后,仍然不能用日志直接支配日志,因为没有安装Lombok插件。

加上@ data注解后,仍然不能使用getter/setter,因为没有安装Lombok插件。

在类上加注解@AllArgsConstructor注解可以代替所有@ autowired注解,就不用在一个类中引入多个@ autowired。
下载前端代码后需要在控制台运行:npm安装、下载前端工程后在控制台npm安装相当于后端的下载jar包,目录级别还不能乱放,按照git工程代码格式,不能新建目录文件,否则资源下不来。

上述内容就是怎么在SpringBoot中利用Mybatis& Mybatis-plus映射文件,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注行业资讯频道。

怎么在SpringBoot中利用Mybatis& Mybatis-plus映射文件