wuyouming666
2024-02-28 9ebd56f767376149ef5ec706e5816c23d53bf718
UnLoadGlassModule/src/main/java/com/mes/config/AppRunnerConfig.java
@@ -1,23 +1,23 @@
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();
    }
}