org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.example.mybatisplus.MyBatisPlusTest': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.example.mybatisplus.mapper.UserMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
①包名是一致的
首先扫描路径到com.example.mybatisplus目录即可,另外,UserMapper接口上要添加@Mapper注解