1. 无法注入的原因,是没有相应的bean,既无法构造对应的mybatis对象。后来同事告诉我,是因为mapper.xml里的对象类型使用了简写,而配置文件缺乏相应配置项的缘故。详细如下: SysConfigMapper.xml,可见其中的type只写了一个简短的类名,而不是完整的,带有包名的类名。 对比我们平时习惯的写法: 对于mapper中数据对象类型...
springboot多模块化整合mybatis,mapper自动注入失败问题及解决
启动类添加@MapperScan或@ComponentScan,mapper类添加@Mapper或@Repository ==> Consider defining a bean of type 'com.ten.mapper.UserMapper' in your configuration. 或 Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required in spring mock mvc test for spring boot with mybatis 解决: 手动装配...