主要有两个地方需要注意:
1、MySqlConfiguration配置类,@MapperScan注解
@Configuration
@MapperScan(basePackages = {"com.example.pagehelper.mapper"}, sqlSessionFactoryRef = "mysqlSqlSessionFactory")
public class MySqlConfiguration
2、yaml配置文件中配置
mybatis:
mapper-locations: classpath:/mapper/*.xml
#实体扫描,多个package用逗号或者分号分隔
type-aliases-package: com.example.pagehelper.entity