Error: Multiple DAOs (* mapper.java) inherit custom generic Mapper (mymapper.java)

1. Error description:

**No qualifying bean of type[main. Java. Base. Dao. MyMapper] is defined: expected single matching bean but found 2: attachmentMapper, userMapper. **Copy the code

Other notes:

If there is only one User table, this is not an error, but if a new Attachment table Attachment table is added, this is an error.Copy the code

2. Other codes

A. There are User table, Attachment table; Mapper: Usermapper. Java and attachmentMapper. Java; The corresponding service interfaces are userService. Java and attachmentService. Java. Interface corresponding to the corresponding implementation class UserServiceImpl. Java and AttachmentServiceImpl. Java. B. There is a custom universal mapper: Mymapper.java. Java and the corresponding interface implementation class BaseServiceImpl. Java. C. Inheritance description: 1. Custom mymapper. Java inherits Mapper<T>,InsertListMapper<T>,IdsMapper<T>. As follows:  public interface MyMapper<T> extends Mapper<T>, InsertListMapper<T>, IdsMapper<T>{} 2. usermapper. Java and attachmentMapper. Java both inherit from Mymapper. Java. As follows:  public interface UserMapper extends MyMapper<User>{} public interface AttachmentMapper extends MyMapper<Attachment>{} 3. Both UserService. Java and AttachmentService inherit baseservice.java. As follows:  public interface AttachmentServiceextends BaseService<User>{} public interface AttachmentService extends BaseService<Attachment>{} 4. Userserviceimp. Java and AttachmentServiceImpl inherit baseserviceImp. Java as follows:  @Service public class UserServiceImpl extends BaseServiceImpl<User> implements UserService{} @Service public class AttachmentServiceImpl extends BaseServiceImpl<Attachment> implements AttachmentService{} d. baseservice. Java  public interface BaseService<T> { public List<T> select(T record); } 3. BaseServiceImpl.  @Service public class BaseServiceImpl<T> implements BaseService<T> { @Resource private MyMapper<T> mapper; @Override public List<T> select(T record) {returnmapper.select(record); E. Configuration file. Application - context. The XML. General mapper configuration: <! -- Use a custom MyMapper for later extension --> <bean class="tk.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="main.java.dao"/>
	<property name="properties" value="main.java.base.dao.MyMapper"/>
       </bean>Copy the code