admin管理员组

文章数量:1794759

Consider defining a bean of type ‘com.csf.mapper.UserMapper‘ in your configuration

Consider defining a bean of type ‘com.csf.mapper.UserMapper‘ in your configuration

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