package com.xxx.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.xxx.listener.StartupListener;
@SpringBootApplication
@EnableAutoConfiguration
@EnableTransactionManagement
public class SpringbootStartApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(StartupListener.class);// 参数应该是 SpringbootStartApplication.class
app.addListeners(new StartupListener());
app.run(args);
}
}
由于一开始 StartupListener.class 命名跟 SpringbootStartApplication比较相似,所以一直没看出来