spring boot 程序启动后执行自定义任务

@Component
@Order(value = 1)
public class startApplication implements ApplicationRunner {
    @Autowired
    private DesMobileEmailService desMobileEmailService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        Integer result = 0;
        do {
            try {
                result = desMobileEmailService.DesSlPasswordIDMapMobileEmail();
            } catch (Exception e) {
                e.printStackTrace();
            }
        } while ( result == 1 );
    }
}

spring boot 程序启动后执行自定义任务_第1张图片

 

你可能感兴趣的:(spring)