Tag Archives: Field usersMapper in com.imooc.impl.UserServiceImpl required a bean of type ‘com.imooc.mapper.UsersMapper’ that could not be found.

Container Cannot Find bean, Field usersMapper in com.imooc.impl.UserServiceImpl required a bean of type ‘com.imooc.mapper.UsersMapper’ that could not be found.

Startup report: no relevant entity class error found

Description:

Field usersMapper in com.imooc.impl.UserServiceImpl required a bean of type 'com.imooc.mapper.UsersMapper' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.imooc.mapper.UsersMapper' in your configuration.

The reason is that the package range of the startup class scanning needs to be annotated with the package path corresponding to the error reporting class

import tk.mybatis.spring.annotation.MapperScan;

@SpringBootApplication
@MapperScan("com.imooc.mapper")
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class,args);
    }
}