[Bug0006]Consider defining a bean of type ‘*Mapper‘ in your configuration.
问题
Consider defining a bean of type ‘*Mapper‘ in your configuration.
原因
在使用新的mybatis时,使用注解@Mapper修饰相应的mapper接口,但是在controller里不能使用@Autowired自动注入,报错
Consider defining a bean of type '*Mapper' in your configuration.
解决方案
在启动类里添加注解@ComponentScan,里面的路径是对应的mapper路径
实例
@SpringBootApplication
@ComponentScan({"com.lll.blog.admin.mapper"})
public class AdminApp {
}
 
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号