SpringBoot项目一启动就执行某段代码

package com.scfenzhi.component;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @Author: DaiYi
 * @CreateTime 2021/9/1 13:58
 * @Email: [email protected]
 * @PhoneNumber: 18380924397
 * @Description:
 */

@Component
public class Runner implements ApplicationRunner {
    
    

    @Override
    public void run(ApplicationArguments args) {
    
    
        System.out.println("do something");
    }

}

猜你喜欢

转载自blog.csdn.net/daiyi666/article/details/120038502
今日推荐