关于@Component下@Autowired注入为null的问题

关于@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.*****************
}

只是一个解决方法,不建议使用,先填坑吧

猜你喜欢

转载自blog.csdn.net/ys880910/article/details/86302561