出现这种异常主要是无法创建bean到容器中,主要有以下几种情况:
controller:
@RestController
@AllArgsConstructor
@RequestMapping("/enterprise")
@Api(value = "企业数据", tags = "企业数据接口")
public class EnterpriseController {
private final IEnterpriseService service;
}
注:
@Autowired private final IEnterpriseService service;
service:
@Service @AllArgsConstructor public class EnterpriseServiceImpl extends BaseServiceImplimplements IEnterpriseService { public List
注:
@Service public class EnterpriseServiceImpl extends BaseServiceImplimplements IEnterpriseService { @Autowired private final EnterpriseMapper mapper; @Autowired private final BlogMapper mapper; public List
@EnableScheduling
@SpringBootApplication
@ComponentScan({"org.springblade","com.hello","com.test"})
@MapperScan({"com.hello.**.mapper.**","com.test.**.mapper.**"})
public class Application {
public static void main(String[] args) {
BladeApplication.run(CommonConstant.APPLICATION_NAME, Application.class, args);
}
}
注:
@GetMapping("/count")
public R test(@RequestBody Enterprise enterprise){
EnterpriseVO detail = service.test(enterprise);
return R.data(detail);
}
@PostMapping("/count")
public R update(@RequestBody Enterprise enterprise){
boolean flag = service.updateByBody(enterprise);
Enterprise entity = service.selectInfo(enterprise);
return R.data(entity);
}
通常出现这种异常会在控制台打印出一堆异常信息,在控制台上方的异常信息大多是和程序真正的问题没有直接关系的,这里给出以下异常排查技巧: