SpringBoot 普通类使用@Autowired注入时为null

1、遇到的问题,普通类使用

@Autowired

private static ICDahuaService cDahuaService;

cDahuaService 为null

 2、解决方法

现在cDahuaService 不为空啦

注意:StartServiceCallBack.CDahuaService = cDahuaService;

其中 StartServiceCallBack 是当前类的类名

扫描二维码关注公众号,回复: 16074818 查看本文章

猜你喜欢

转载自blog.csdn.net/weixin_51906670/article/details/129205522