From 687199e6887f83cc63a62cc837b9f1f4d826c656 Mon Sep 17 00:00:00 2001 From: Matt Benson Date: Tue, 28 Jun 2016 10:58:57 -0500 Subject: [PATCH] Add an accessor for webEnvironment to SpringApplication Closes gh-6241 --- .../java/org/springframework/boot/SpringApplication.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 cc7fef55d3..1d63af9cb4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -928,6 +928,15 @@ public class SpringApplication { this.mainApplicationClass = mainApplicationClass; } + /** + * Returns whether this {@link SpringApplication} is running within a web environment. + * @return {@code true} if running within a web environment, otherwise {@code false}. + * @see #setWebEnvironment(boolean) + */ + public boolean isWebEnvironment() { + return this.webEnvironment; + } + /** * Sets if this application is running within a web environment. If not specified will * attempt to deduce the environment based on the classpath.