mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Fix service integration tests
This commit is contained in:
parent
361f500ed5
commit
dd1fc3f992
@ -48,10 +48,13 @@ public class ShutdownEndpoint implements ApplicationContextAware,
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ContainerProperties configuration = new ContainerProperties();
|
private ContainerProperties configuration = new ContainerProperties();
|
||||||
|
|
||||||
|
private boolean shuttingDown = false;
|
||||||
|
|
||||||
@RequestMapping(value = "${endpoints.shutdown.path:/shutdown}", method = RequestMethod.POST)
|
@RequestMapping(value = "${endpoints.shutdown.path:/shutdown}", method = RequestMethod.POST)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Map<String, Object> shutdown() {
|
public Map<String, Object> shutdown() {
|
||||||
if (this.configuration.isAllowShutdown()) {
|
if (this.configuration.isAllowShutdown()) {
|
||||||
|
this.shuttingDown = true;
|
||||||
return Collections.<String, Object> singletonMap("message",
|
return Collections.<String, Object> singletonMap("message",
|
||||||
"Shutting down, bye...");
|
"Shutting down, bye...");
|
||||||
} else {
|
} else {
|
||||||
@ -70,7 +73,8 @@ public class ShutdownEndpoint implements ApplicationContextAware,
|
|||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ServletRequestHandledEvent event) {
|
public void onApplicationEvent(ServletRequestHandledEvent event) {
|
||||||
|
|
||||||
if (this.context != null && this.configuration.isAllowShutdown()) {
|
if (this.context != null && this.configuration.isAllowShutdown()
|
||||||
|
&& this.shuttingDown) {
|
||||||
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user