From 2169bbbc9b46c74706b04d9663b6dba8b442edc4 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 1 Oct 2015 17:45:43 +0100 Subject: [PATCH] Check Environment matches webEnvironment after it is initialized After the ApplicationEnvironmentPrepared we now check that the webEnvironment flag and/or the Environment hasn't changed, in case the user wanted to switch the context from a web to non-web in a listener. Fixes gh-2716 --- .../boot/SpringApplication.java | 86 +++++++++++----- .../boot/SpringApplicationTests.java | 98 +++++++++++++------ 2 files changed, 127 insertions(+), 57 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 3e04228d4ed..3d96535f6dd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -120,7 +120,8 @@ import org.springframework.web.context.support.StandardServletEnvironment; * your application, however, any of the following sources can also be used: * *