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
8ec9f237
Commit
8ec9f237
authored
Oct 29, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Add Log Output when DevTools restart is disabled"
Closes gh-14807
parent
e76605ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
RestartApplicationListener.java
...ork/boot/devtools/restart/RestartApplicationListener.java
+4
-5
RestartApplicationListenerTests.java
...oot/devtools/restart/RestartApplicationListenerTests.java
+8
-0
No files found.
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/RestartApplicationListener.java
View file @
8ec9f237
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -68,17 +68,16 @@ public class RestartApplicationListener
if
(
enabled
==
null
||
Boolean
.
parseBoolean
(
enabled
))
{
String
[]
args
=
event
.
getArgs
();
DefaultRestartInitializer
initializer
=
new
DefaultRestartInitializer
();
boolean
restartOnInitialize
=
true
;
if
(
AgentReloader
.
isActive
()
)
{
boolean
restartOnInitialize
=
!
AgentReloader
.
isActive
()
;
if
(
!
restartOnInitialize
)
{
logger
.
info
(
"Restart disabled due to an agent-based reloader being active"
);
restartOnInitialize
=
false
;
}
Restarter
.
initialize
(
args
,
false
,
initializer
,
restartOnInitialize
);
}
else
{
logger
.
info
(
"Restart disabled due to System property '"
+
ENABLED_PROPERTY
+
"' set to false"
);
+
"'
being
set to false"
);
Restarter
.
disable
();
}
}
...
...
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestartApplicationListenerTests.java
View file @
8ec9f237
...
...
@@ -20,6 +20,7 @@ import java.util.List;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.springframework.boot.SpringApplication
;
...
...
@@ -27,6 +28,7 @@ import org.springframework.boot.context.event.ApplicationFailedEvent;
import
org.springframework.boot.context.event.ApplicationPreparedEvent
;
import
org.springframework.boot.context.event.ApplicationReadyEvent
;
import
org.springframework.boot.context.event.ApplicationStartingEvent
;
import
org.springframework.boot.test.rule.OutputCapture
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.core.Ordered
;
import
org.springframework.test.util.ReflectionTestUtils
;
...
...
@@ -47,6 +49,9 @@ public class RestartApplicationListenerTests {
private
static
final
String
[]
ARGS
=
new
String
[]
{
"a"
,
"b"
,
"c"
};
@Rule
public
final
OutputCapture
output
=
new
OutputCapture
();
@Before
@After
public
void
cleanup
()
{
...
...
@@ -81,8 +86,11 @@ public class RestartApplicationListenerTests {
@Test
public
void
disableWithSystemProperty
()
{
System
.
setProperty
(
ENABLED_PROPERTY
,
"false"
);
this
.
output
.
reset
();
testInitialize
(
false
);
assertThat
(
Restarter
.
getInstance
()).
hasFieldOrPropertyWithValue
(
"enabled"
,
false
);
assertThat
(
this
.
output
.
toString
())
.
contains
(
"Restart disabled due to System property"
);
}
private
void
testInitialize
(
boolean
failed
)
{
...
...
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