package com.test.web.core.config;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GaiBuSheZhangV1 implements ApplicationContextAware {
private ApplicationContext context;
@PostMapping("/callmedaddy")
public String enjoy() {
ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) context;
ctx.close();
return null;
}
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
context = applicationContext;
}
}
如何优雅的停止springboot项目
最新推荐文章于 2025-04-24 23:08:58 发布