admin管理员组文章数量:1025526
SpringBoot整合mybatis时,启动报错:
**Field userMapper in com.csf.controller.UserController required a bean of type ‘com.csf.mapper.UserMapper’ that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type ‘com.csf.mapper.UserMapper’ in your configuration.
Process finished with exit code 1
**
找不到UserMapper这个接口,具体原因,UserMapper没有被IOC容器扫描到,我的包导入的都是正确的,唯一没有弄好的时springboot启动器上面没有添加注解,具体映射扫描到UserMapper所在的包。
添加@MapperScan()
@SpringBootApplication
@MapperScan("com.csf.mapper")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class,args);
}
}
OK!
稍微记录一下!
SpringBoot整合mybatis时,启动报错:
**Field userMapper in com.csf.controller.UserController required a bean of type ‘com.csf.mapper.UserMapper’ that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type ‘com.csf.mapper.UserMapper’ in your configuration.
Process finished with exit code 1
**
找不到UserMapper这个接口,具体原因,UserMapper没有被IOC容器扫描到,我的包导入的都是正确的,唯一没有弄好的时springboot启动器上面没有添加注解,具体映射扫描到UserMapper所在的包。
添加@MapperScan()
@SpringBootApplication
@MapperScan("com.csf.mapper")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class,args);
}
}
OK!
稍微记录一下!
本文标签: TypeBeandefiningcsfConfiguration
版权声明:本文标题:Consider defining a bean of type ‘com.csf.mapper.UserMapper‘ in your configuration 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1738336583a1562806.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论