admin管理员组

文章数量:1531244

在使用最新的mybatis-3.5.6时,使用注解@Mapper修饰相应的mapper接口,但是在controller里不能使用@Autowired自动注入,报错
Consider defining a bean of type '*Mapper' in your configuration.

但是使用mybatis-2.0.0就不会出现这个错误。

经过查找,分析,发现在启动类里添加注解@ComponentScan,可以解决这个问题,里面的路径是对应的mapper路径

@SpringBootApplication
@ComponentScan({"com.delivery.mapper"})
public class WebServiceApplication extends SpringBootServletInitializer {

参考

本文标签: beandefiningtypeconfigurationmapper