Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
7801a387
Commit
7801a387
authored
Oct 01, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect against missing spring-web.jar
See gh-4068
parent
6be072ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
SpringApplication.java
...main/java/org/springframework/boot/SpringApplication.java
+14
-1
No files found.
spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
View file @
7801a387
...
...
@@ -161,6 +161,8 @@ public class SpringApplication {
private
static
final
String
[]
WEB_ENVIRONMENT_CLASSES
=
{
"javax.servlet.Servlet"
,
"org.springframework.web.context.ConfigurableWebApplicationContext"
};
private
static
final
String
CONFIGURABLE_WEB_ENVIRONMENT_CLASS
=
"org.springframework.web.context.ConfigurableWebEnvironment"
;
private
static
final
String
SYSTEM_PROPERTY_JAVA_AWT_HEADLESS
=
"java.awt.headless"
;
private
static
final
Banner
DEFAULT_BANNER
=
new
SpringBootBanner
();
...
...
@@ -317,7 +319,7 @@ public class SpringApplication {
ConfigurableEnvironment
environment
=
getOrCreateEnvironment
();
configureEnvironment
(
environment
,
args
);
listeners
.
environmentPrepared
(
environment
);
if
(
environment
instanceof
StandardServletEnvironment
&&
!
this
.
webEnvironment
)
{
if
(
isWebEnvironment
(
environment
)
&&
!
this
.
webEnvironment
)
{
environment
=
convertToStandardEnvironment
(
environment
);
}
...
...
@@ -434,6 +436,17 @@ public class SpringApplication {
configureProfiles
(
environment
,
args
);
}
private
boolean
isWebEnvironment
(
ConfigurableEnvironment
environment
)
{
try
{
Class
<?>
webEnvironmentClass
=
ClassUtils
.
forName
(
CONFIGURABLE_WEB_ENVIRONMENT_CLASS
,
getClassLoader
());
return
(
webEnvironmentClass
.
isInstance
(
environment
));
}
catch
(
Throwable
ex
)
{
return
false
;
}
}
private
ConfigurableEnvironment
convertToStandardEnvironment
(
ConfigurableEnvironment
environment
)
{
StandardEnvironment
result
=
new
StandardEnvironment
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment