背景
昨天好好的代码,今天队友改了数据,就一直报错。
把数据全部初始化也不行。
后来才知道,是环境问题,昨天我用代码显式配置了mybatis。
原因
网上说是mapper文件扫描不到,我明明在启动类上配置了@MapperScan,
后来才想起来,mybatis用代码方式配置后,@MapperScan注解失效。
必须要手动加入
代码
@Bean
// map-underscore-to-camel-case: true
@ConfigurationProperties(prefix = "mybatis.configuration" )
public Configuration golbarConfiger()