严智鑫
2024-03-07 37158be415622bd43fdd7cd5e19a20c6d49854f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.mes.config;
 
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
class AppStartup implements ApplicationListener<ContextRefreshedEvent> {
 
    private final DownGlassInfoService downGlassInfoService;
 
    public AppStartup(DownGlassInfoService downGlassInfoService) {
        this.downGlassInfoService = downGlassInfoService;
    }
 
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        Plcaction.setDownGlassInfoService(downGlassInfoService);
        new Plcaction().start();
    }
}