|
|
|
@ -22,7 +22,7 @@ import java.util.Map;
|
|
|
|
@EnableScheduling
|
|
|
|
@EnableScheduling
|
|
|
|
@EnableAsync
|
|
|
|
@EnableAsync
|
|
|
|
@SpringBootApplication
|
|
|
|
@SpringBootApplication
|
|
|
|
public class AdminClientTemperatureApplication extends SpringBootServletInitializer implements CommandLineRunner, ApplicationContextAware {
|
|
|
|
public class AdminClientTemperatureApplication implements CommandLineRunner, ApplicationContextAware {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取Spring框架的上下文
|
|
|
|
* 获取Spring框架的上下文
|
|
|
|
@ -38,22 +38,13 @@ public class AdminClientTemperatureApplication extends SpringBootServletInitiali
|
|
|
|
SpringApplication.run(AdminClientTemperatureApplication.class, args);
|
|
|
|
SpringApplication.run(AdminClientTemperatureApplication.class, args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @date 2025-06-01 14:32
|
|
|
|
|
|
|
|
* @description: 容器配置,springboot打war包布署必须添加这个配置 为了打包springboot项目
|
|
|
|
|
|
|
|
* @Param: SpringApplicationBuilder
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
|
|
|
|
|
|
|
return builder.sources(AdminClientTemperatureApplication.class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 调用 applicationContext(不能在main中使用,main是static的,不能调用)
|
|
|
|
* 调用 applicationContext(不能在main中使用,main是static的,不能调用)
|
|
|
|
* @param args
|
|
|
|
* @param args
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run(String... args) throws Exception {
|
|
|
|
public void run(String... args) {
|
|
|
|
//在这里可以调用applicationContext了
|
|
|
|
//在这里可以调用applicationContext了
|
|
|
|
Map<String, Object> controllers = applicationContext.getBeansWithAnnotation(RequestMapping.class);
|
|
|
|
Map<String, Object> controllers = applicationContext.getBeansWithAnnotation(RequestMapping.class);
|
|
|
|
for (Map.Entry<String, Object> entry : controllers.entrySet()) {
|
|
|
|
for (Map.Entry<String, Object> entry : controllers.entrySet()) {
|
|
|
|
|