package <%= packageName %>.config;

import <%= packageName %>.oss.service.OssConfigService;
import <%= packageName %>.system.service.SmsSupplierService;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CommonApplicationListener implements ApplicationListener<ApplicationReadyEvent> {

    private final SmsSupplierService smsSupplierService;

    private final OssConfigService ossConfigService;

    public CommonApplicationListener(SmsSupplierService smsSupplierService, OssConfigService ossConfigService) {
        this.smsSupplierService = smsSupplierService;
        this.ossConfigService = ossConfigService;
    }

    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        ossConfigService.initPlatforms();
        smsSupplierService.initService();
    }

}
