| | |
| | | package com.mes.config; |
| | | |
| | | |
| | | import com.mes.*; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.core.annotation.Order; |
| | | import com.mes.service.Plcaction; |
| | | import com.mes.service.DownGlassInfoService; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.context.event.ContextRefreshedEvent; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | @Order(1) |
| | | class AppStartup implements ApplicationListener<ContextRefreshedEvent> { |
| | | |
| | | public class AppRunnerConfig implements ApplicationRunner { |
| | | private final DownGlassInfoService downGlassInfoService; |
| | | |
| | | public AppStartup(DownGlassInfoService downGlassInfoService) { |
| | | this.downGlassInfoService = downGlassInfoService; |
| | | } |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | // TODO Auto-generated method stub |
| | | // |
| | | System.out.println("启动完成"); |
| | | |
| | | |
| | | public void onApplicationEvent(ContextRefreshedEvent event) { |
| | | Plcaction.setDownGlassInfoService(downGlassInfoService); |
| | | new Plcaction().start(); |
| | | } |
| | | } |