-
添加依赖
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>xxx</version> </dependency>
-
添加配置文件
mybatis: mapper-locations: classpath:mybatis/**/*Mapper.xml type-aliases-package: com.test.mapper.entity configuration: map-underscore-to-camel-case: true
-
在启动类上需要加入一个注解指定mapper接口的位置即可:@MapperScan("com.test.mapper")