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 { private final DownGlassInfoService downGlassInfoService; public AppStartup(DownGlassInfoService downGlassInfoService) { this.downGlassInfoService = downGlassInfoService; } @Override public void onApplicationEvent(ContextRefreshedEvent event) { Plcaction.setDownGlassInfoService(downGlassInfoService); new Plcaction().start(); } }