启动类上的@MapperScan注解与yml配置中mybatis.mapper-locations和mybatis.type-aliases-package的作用
@MapperScan这个注解是用户扫描mapper接口的,也就是dao类@MapperScan({"com.flying.supershop.common.mapper","com.flying.supershop.common.search"})mybatis.mapper-locations:用于扫描mapper.xml的,和 @MapperScan 二者对应,缺少一个都会报错mybatis
·
@MapperScan
这个注解是用户扫描mapper接口的,也就是dao类
@MapperScan({"com.flying.supershop.common.mapper","com.flying.supershop.common.search"})
mybatis.mapper-locations:
用于扫描mapper.xml的,和 @MapperScan 二者对应,缺少一个都会报错
mybatis.mapper-locations: classpath*:mapper/*.xml,classpath*:search/*.xml
mybatis.type-aliases-package:
用于扫描 pojo 类
mybatis.type-aliases-package: com.flying.supershop.common.pojo,com.flying.supershop.common.search
更多推荐



所有评论(0)