今天使用mybatis 通用注解時(shí)一直報(bào)錯(cuò),找了好久終于找到一個(gè)大神的答案油坝,在這里記錄一下
No qualifying bean of type 'tk.mybatis.mapper.common.Mapper<?>' available: expected single matching bean but found 3
原來(lái)是這樣寫的
public abstract class BaseService<T> implements IService<T> {
@Resource
protected Mapper<T> mapper;
給泛型注入的時(shí)候只能用@Autowired,改成下面就好了
public abstract class BaseService<T> implements IService<T> {
@Autowired
protected Mapper<T> mapper;