1. Error reporting
Two classes inherit com baomidou. mybatisplus. mapper. BaseMapper
Service startup error:
Field baseMapper in com.baomidou.mybatisplus.service.impl.ServiceImpl required a single bean, but 2 were found:
- UserDao: defined in file [D:\projects\test\UserDao.class]
- DepartmentDao: defined in file [D:\projects\test\DepartmentDao.class]
The code is as follows
public interface UserDao extends BaseMapper<UserInfo>{ }
public interface DepartmentDao extends BaseMapper{ }
2. Error reporting reason
Departmentdao did not specify a generic type when inheriting basemapper
3. Solution:
Specifying generics when departmentdao inherits basemapper
public interface DepartmentDao extends BaseMapper<DepartmentInfo>{ }