SpringBoot ordinary classes are null when injected with @Autowired

1. The problems encountered, ordinary class use

@Autowired

private static ICDahuaService cDahuaService;

cDahuaService is null

 2. Solution

Now cDahuaService is not empty

注意:StartServiceCallBack.CDahuaService = cDahuaService;

Where StartServiceCallBack is the class name of the current class

Guess you like

Origin blog.csdn.net/weixin_51906670/article/details/129205522