关于@Component下@Autowired注入为null的问题@TOC
@Component
public class TimingTaskController{
public static TimingTaskController timingTaskController;
@Autowired
private OrderService orderService;
@PostConstruct
public void init() {
timingTaskController = this;
timingTaskController.orderService = this.orderService;
}
//调用的时候
timingTaskController.orderService.*****************
}
只是一个解决方法,不建议使用,先填坑吧