-
SpringBoot使用Mybatis&Mybatis-plus文件映射配置
简介:Springboot使用Mybatis&Mybatis-plus 两者文件映射配置略有不同,之前我用的是Mybatis,但公司用Mybatis-plus;自己新建了一个Springboot项目,代码运行时一直报错not found not found,明明配置了mybatis相关信息的扫描路径,但是就是not found;检查修改了很多地方但都是无用功,最终发现是Plus惹的祸。
1、使用Mybatis
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
yml文件配置的mapper映射及相关信息格式:
mybatis:
mapper-locations: classpath:mybatis/mapper/*.xml
config-locations: classpath:mybatis/mybatis-config.xml
type-aliases-package: com.ausclouds.bdbsec.entity
2、使用Mybatis-Plus
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>
yml文件配置的mapper映射及相关信息格式:
mybatis-plus:
mapper-locations: classpath:mybatis/mapper/*.xml
config-locations: classpath:mybatis/mybatis-config.xml
type-aliases-package: com.example.demo.entity
3、Others
加上@Slf4j 注解后,仍然不能用log直接支配日志,因为没有安装Lombok插件。
加上@Data 注解后,仍然不能使用getter/setter,因为没有安装Lombok插件。
在类上加注解@AllArgsConstructor 注解可以代替所有@Autowired 注解,就不用在一个类中引入多个@Autowired。
下载前端代码后需要在控制台运行:npm install,下载前端工程后在控制台npm install 相当于后端的下载jar包,目录级别还不能乱放,按照git工程代码格式,不能新建目录文件,否则资源下不来。
原文:https://www.cnblogs.com/taojietaoge/p/14555692.html
最新更新
求1000阶乘的结果末尾有多少个0
详解MyBatis延迟加载是如何实现的
IDEA 控制台中文乱码4种解决方案
SpringBoot中版本兼容性处理的实现示例
Spring的IOC解决程序耦合的实现
详解Spring多数据源如何切换
Java报错:UnsupportedOperationException in Col
使用Spring Batch实现批处理任务的详细教程
java中怎么将多个音频文件拼接合成一个
SpringBoot整合ES多个精确值查询 terms功能实
数据库审计与智能监控:从日志分析到异
SQL Server 中的数据类型隐式转换问题
SQL Server中T-SQL 数据类型转换详解
sqlserver 数据类型转换小实验
SQL Server数据类型转换方法
SQL Server 2017无法连接到服务器的问题解决
SQLServer地址搜索性能优化
Sql Server查询性能优化之不可小觑的书签查
SQL Server数据库的高性能优化经验总结
SQL SERVER性能优化综述(很好的总结,不要错
uniapp/H5 获取手机桌面壁纸 (静态壁纸)
[前端] DNS解析与优化
为什么在js中需要添加addEventListener()?
JS模块化系统
js通过Object.defineProperty() 定义和控制对象
这是目前我见过最好的跨域解决方案!
减少回流与重绘
减少回流与重绘
如何使用KrpanoToolJS在浏览器切图
performance.now() 与 Date.now() 对比