1, when the project started, can not find mapper file
Description:
Field stuMapper in com.zb.service.impl.StuServiceImpl required a bean of type 'com.zb.mapper.StuMapper' 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.zb.mapper.StuMapper' in your configuration.
The reason is: mapper is not injected into the vessel
The solution is: In the startup file, add @MapperScan (basePackages = "com.zb.mapper"), basePackages is the folder where the file mapper
@SpringBootApplication @MapperScan(basePackages = "com.zb.mapper") public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }