实现应用启动的时候初始化或者调用
package com.example.demo.init;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
/**
* @author duanxiaoqiu
* @Date 2019-06-17 20:12
**/
@Slf4j
@Component
public class initData implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
}
}
@Order(value=0) 实现先后循序
package com.example.demo.init;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* @author duanxiaoqiu
* @Date 2019-06-17 20:12
**/
@Slf4j
@Order(value = 0)
@Component
public class initData implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
}
}