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
48b5b6a2
Commit
48b5b6a2
authored
Aug 23, 2019
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Added support for devtools YAML configuration"
See gh-17915
parent
00a3ad0f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
102 deletions
+89
-102
DevToolsHomePropertiesPostProcessor.java
...oot/devtools/env/DevToolsHomePropertiesPostProcessor.java
+31
-22
DevToolsHomePropertiesPostProcessorTests.java
...evtools/env/DevToolsHomePropertiesPostProcessorTests.java
+42
-74
spring-boot-features.adoc
...ing-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+1
-1
using-spring-boot.adoc
...spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc
+15
-5
No files found.
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessor.java
View file @
48b5b6a2
...
@@ -18,14 +18,17 @@ package org.springframework.boot.devtools.env;
...
@@ -18,14 +18,17 @@ package org.springframework.boot.devtools.env;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.
logging.Logger
;
import
java.util.
function.Function
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.devtools.DevToolsEnablementDeducer
;
import
org.springframework.boot.devtools.DevToolsEnablementDeducer
;
import
org.springframework.boot.env.EnvironmentPostProcessor
;
import
org.springframework.boot.env.EnvironmentPostProcessor
;
import
org.springframework.core.env.ConfigurableEnvironment
;
import
org.springframework.core.env.ConfigurableEnvironment
;
import
org.springframework.core.env.PropertiesPropertySource
;
import
org.springframework.core.env.PropertiesPropertySource
;
import
org.springframework.core.env.PropertySource
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.core.io.support.PropertiesLoaderUtils
;
import
org.springframework.core.io.support.PropertiesLoaderUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -37,46 +40,52 @@ import org.springframework.util.StringUtils;
...
@@ -37,46 +40,52 @@ import org.springframework.util.StringUtils;
* @author Phillip Webb
* @author Phillip Webb
* @author Andy Wilkinson
* @author Andy Wilkinson
* @author HaiTao Zhang
* @author HaiTao Zhang
* @author Madhura Bhave
* @since 1.3.0
* @since 1.3.0
*/
*/
public
class
DevToolsHomePropertiesPostProcessor
implements
EnvironmentPostProcessor
{
public
class
DevToolsHomePropertiesPostProcessor
implements
EnvironmentPostProcessor
{
private
static
final
String
LEGACY_FILE_NAME
=
".spring-boot-devtools.properties"
;
private
static
final
String
[]
FILE_NAMES
=
new
String
[]
{
".spring-boot-devtools.yml"
,
".spring-boot-devtools.yaml"
,
private
static
final
String
[]
FILE_NAMES
=
new
String
[]
{
".spring-boot-devtools.yml"
,
".spring-boot-devtools.yaml"
,
".spring-boot-devtools.properties"
};
".spring-boot-devtools.properties"
};
private
Logger
logger
=
Logger
.
getLogger
(
getClass
().
getName
())
;
private
static
final
String
CONFIG_PATH
=
"/.config/spring-boot/"
;
@Override
@Override
public
void
postProcessEnvironment
(
ConfigurableEnvironment
environment
,
SpringApplication
application
)
{
public
void
postProcessEnvironment
(
ConfigurableEnvironment
environment
,
SpringApplication
application
)
{
if
(
DevToolsEnablementDeducer
.
shouldEnable
(
Thread
.
currentThread
()))
{
if
(
DevToolsEnablementDeducer
.
shouldEnable
(
Thread
.
currentThread
()))
{
File
home
=
getHomeFolder
();
List
<
PropertySource
>
propertySources
=
getPropertySources
();
Properties
properties
=
processDir
(
home
,
"/.config/spring-boot/"
,
environment
);
if
(
propertySources
.
isEmpty
())
{
if
(
properties
.
isEmpty
())
{
addPropertySource
(
LEGACY_FILE_NAME
,
(
file
)
->
"devtools-local"
,
propertySources
);
processDir
(
home
,
""
,
environment
);
}
}
propertySources
.
forEach
((
source
)
->
environment
.
getPropertySources
().
addFirst
(
source
));
}
}
}
}
private
Properties
processDir
(
File
home
,
String
configPath
,
ConfigurableEnvironment
environment
)
{
private
List
<
PropertySource
>
getPropertySources
(
)
{
Properties
properties
=
new
Properties
();
List
<
PropertySource
>
propertySources
=
new
ArrayList
<>
();
for
(
String
fileName
:
FILE_NAMES
)
{
for
(
String
fileName
:
FILE_NAMES
)
{
File
propertyFile
=
(
home
!=
null
)
?
new
File
(
home
,
configPath
+
fileName
)
:
null
;
addPropertySource
(
CONFIG_PATH
+
fileName
,
(
file
)
->
"devtools-local: ["
+
file
.
toURI
()
+
"]"
,
if
(
propertyFile
!=
null
&&
propertyFile
.
exists
()
&&
propertyFile
.
isFile
())
{
propertySources
);
addProperty
(
propertyFile
,
environment
,
fileName
,
properties
);
}
}
}
return
propert
i
es
;
return
propert
ySourc
es
;
}
}
private
void
addProperty
(
File
propertyFile
,
ConfigurableEnvironment
environment
,
String
fileName
,
private
void
addPropertySource
(
String
fileName
,
Function
<
File
,
String
>
propertySourceName
,
Properties
properties
)
{
List
<
PropertySource
>
propertySources
)
{
FileSystemResource
resource
=
new
FileSystemResource
(
propertyFile
);
Properties
properties
;
try
{
File
home
=
getHomeFolder
();
PropertiesLoaderUtils
.
fillProperties
(
properties
,
resource
);
File
propertyFile
=
(
home
!=
null
)
?
new
File
(
home
,
fileName
)
:
null
;
environment
.
getPropertySources
().
addFirst
(
new
PropertiesPropertySource
(
"devtools-local"
,
properties
));
if
(
propertyFile
!=
null
&&
propertyFile
.
exists
()
&&
propertyFile
.
isFile
())
{
}
FileSystemResource
resource
=
new
FileSystemResource
(
propertyFile
);
catch
(
IOException
ex
)
{
try
{
throw
new
IllegalStateException
(
"Unable to load "
+
fileName
,
ex
);
properties
=
PropertiesLoaderUtils
.
loadProperties
(
resource
);
propertySources
.
add
(
new
PropertiesPropertySource
(
propertySourceName
.
apply
(
propertyFile
),
properties
));
}
catch
(
IOException
ex
)
{
throw
new
IllegalStateException
(
"Unable to load "
+
fileName
,
ex
);
}
}
}
}
}
...
...
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessorTests.java
View file @
48b5b6a2
...
@@ -37,97 +37,60 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -37,97 +37,60 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Phillip Webb
* @author Phillip Webb
* @author Andy Wilkinson
* @author Andy Wilkinson
* @author HaiTao Zhang
* @author HaiTao Zhang
* @author Madhura Bhave
*/
*/
class
DevToolsHomePropertiesPostProcessorTests
{
class
DevToolsHomePropertiesPostProcessorTests
{
private
String
configDir
;
private
File
home
;
private
File
home
;
@BeforeEach
@BeforeEach
void
setup
(
@TempDir
File
tempDir
)
throws
IOException
{
void
setup
(
@TempDir
File
tempDir
)
{
this
.
home
=
tempDir
;
this
.
home
=
tempDir
;
this
.
configDir
=
this
.
home
+
"/.config/spring-boot/"
;
new
File
(
this
.
configDir
).
mkdirs
();
}
}
@Test
@Test
void
loadsPropertiesFromHomeFolderUsingProperties
()
throws
Exception
{
void
loadsPropertiesFromHomeFolderUsingProperties
()
throws
Exception
{
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
properties
.
put
(
"abc"
,
"def"
);
properties
.
put
(
"abc"
,
"def"
);
OutputStream
out
=
new
FileOutputStream
(
new
File
(
this
.
home
,
".spring-boot-devtools.properties"
));
writeFile
(
properties
,
".spring-boot-devtools.properties"
);
properties
.
store
(
out
,
null
);
ConfigurableEnvironment
environment
=
getPostProcessedEnvironment
();
out
.
close
();
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"def"
);
}
@Test
void
loadsPropertiesFromHomeFolderUsingYml
()
throws
Exception
{
Properties
properties
=
new
Properties
();
properties
.
put
(
"abc"
,
"def"
);
OutputStream
out
=
new
FileOutputStream
(
new
File
(
this
.
home
,
".spring-boot-devtools.yml"
));
properties
.
store
(
out
,
null
);
out
.
close
();
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"def"
);
}
@Test
void
loadsPropertiesFromHomeFolderUsingYaml
()
throws
Exception
{
Properties
properties
=
new
Properties
();
properties
.
put
(
"abc"
,
"def"
);
OutputStream
out
=
new
FileOutputStream
(
new
File
(
this
.
home
,
".spring-boot-devtools.yaml"
));
properties
.
store
(
out
,
null
);
out
.
close
();
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"def"
);
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"def"
);
}
}
@Test
@Test
void
loadsPropertiesFromConfigFolderUsingProperties
()
throws
Exception
{
void
loadsPropertiesFromConfigFolderUsingProperties
()
throws
Exception
{
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
new
File
(
this
.
home
+
"/.config/spring-boot"
).
mkdirs
();
properties
.
put
(
"abc"
,
"def"
);
properties
.
put
(
"abc"
,
"def"
);
OutputStream
out
=
new
FileOutputStream
(
OutputStream
out
=
new
FileOutputStream
(
new
File
(
this
.
configDir
,
".spring-boot-devtools.properties"
));
new
File
(
this
.
home
+
"/.config/spring-boot"
,
".spring-boot-devtools.properties"
));
properties
.
store
(
out
,
null
);
properties
.
store
(
out
,
null
);
out
.
close
();
out
.
close
();
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
ConfigurableEnvironment
environment
=
getPostProcessedEnvironment
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"def"
);
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"def"
);
}
}
@Test
@Test
void
loadsPropertiesFromConfigFolderUsingYml
()
throws
Exception
{
void
loadsPropertiesFromConfigFolderUsingYml
()
throws
Exception
{
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
new
File
(
this
.
home
+
"/.config/spring-boot"
).
mkdirs
();
properties
.
put
(
"abc"
,
"def"
);
properties
.
put
(
"abc"
,
"def"
);
OutputStream
out
=
new
FileOutputStream
(
OutputStream
out
=
new
FileOutputStream
(
new
File
(
this
.
configDir
,
".spring-boot-devtools.yml"
));
new
File
(
this
.
home
+
"/.config/spring-boot"
,
".spring-boot-devtools.yml"
));
properties
.
store
(
out
,
null
);
properties
.
store
(
out
,
null
);
out
.
close
();
out
.
close
();
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
ConfigurableEnvironment
environment
=
getPostProcessedEnvironment
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"def"
);
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"def"
);
}
}
@Test
@Test
void
loadsPropertiesFromConfigFolderUsingYaml
()
throws
Exception
{
void
loadsPropertiesFromConfigFolderUsingYaml
()
throws
Exception
{
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
new
File
(
this
.
home
+
"/.config/spring-boot"
).
mkdirs
();
properties
.
put
(
"abc"
,
"def"
);
properties
.
put
(
"abc"
,
"def"
);
OutputStream
out
=
new
FileOutputStream
(
OutputStream
out
=
new
FileOutputStream
(
new
File
(
this
.
configDir
,
".spring-boot-devtools.yaml"
));
new
File
(
this
.
home
+
"/.config/spring-boot"
,
".spring-boot-devtools.yaml"
));
properties
.
store
(
out
,
null
);
properties
.
store
(
out
,
null
);
out
.
close
();
out
.
close
();
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
ConfigurableEnvironment
environment
=
getPostProcessedEnvironment
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"def"
);
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"def"
);
}
}
...
@@ -135,7 +98,7 @@ class DevToolsHomePropertiesPostProcessorTests {
...
@@ -135,7 +98,7 @@ class DevToolsHomePropertiesPostProcessorTests {
void
loadFromConfigFolderWithPropertiesTakingPrecedence
()
throws
Exception
{
void
loadFromConfigFolderWithPropertiesTakingPrecedence
()
throws
Exception
{
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
properties
.
put
(
"abc"
,
"def"
);
properties
.
put
(
"abc"
,
"def"
);
new
File
(
this
.
home
+
"/.config/spring-boot"
).
mkdirs
(
);
properties
.
put
(
"bar"
,
"baz"
);
OutputStream
out
=
new
FileOutputStream
(
OutputStream
out
=
new
FileOutputStream
(
new
File
(
this
.
home
+
"/.config/spring-boot/"
,
".spring-boot-devtools.yaml"
));
new
File
(
this
.
home
+
"/.config/spring-boot/"
,
".spring-boot-devtools.yaml"
));
properties
.
store
(
out
,
null
);
properties
.
store
(
out
,
null
);
...
@@ -146,57 +109,62 @@ class DevToolsHomePropertiesPostProcessorTests {
...
@@ -146,57 +109,62 @@ class DevToolsHomePropertiesPostProcessorTests {
new
File
(
this
.
home
+
"/.config/spring-boot/"
,
".spring-boot-devtools.properties"
));
new
File
(
this
.
home
+
"/.config/spring-boot/"
,
".spring-boot-devtools.properties"
));
properties2
.
store
(
out2
,
null
);
properties2
.
store
(
out2
,
null
);
out2
.
close
();
out2
.
close
();
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
ConfigurableEnvironment
environment
=
getPostProcessedEnvironment
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"jkl"
);
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"jkl"
);
assertThat
(
environment
.
getProperty
(
"bar"
)).
isEqualTo
(
"baz"
);
}
}
@Test
@Test
void
loadFrom
HomeFolderWithPropertiesTakingPrecedence
()
throws
Exception
{
void
loadFrom
ConfigFolderTakesPrecedenceOverHomeFolder
()
throws
Exception
{
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
properties
.
put
(
"abc"
,
"def"
);
properties
.
put
(
"abc"
,
"def"
);
new
File
(
this
.
home
+
"/.config/spring-boot"
).
mkdirs
();
properties
.
put
(
"bar"
,
"baz"
);
OutputStream
out
=
new
FileOutputStream
(
new
File
(
this
.
home
,
".spring-boot-devtools.yaml"
));
writeFile
(
properties
,
".spring-boot-devtools.properties"
);
properties
.
store
(
out
,
null
);
out
.
close
();
Properties
properties2
=
new
Properties
();
Properties
properties2
=
new
Properties
();
properties2
.
put
(
"abc"
,
"jkl"
);
properties2
.
put
(
"abc"
,
"jkl"
);
OutputStream
out2
=
new
FileOutputStream
(
new
File
(
this
.
home
,
".spring-boot-devtools.properties"
));
OutputStream
out2
=
new
FileOutputStream
(
new
File
(
this
.
home
+
"/.config/spring-boot/"
,
".spring-boot-devtools.properties"
));
properties2
.
store
(
out2
,
null
);
properties2
.
store
(
out2
,
null
);
out2
.
close
();
out2
.
close
();
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
ConfigurableEnvironment
environment
=
getPostProcessedEnvironment
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"jkl"
);
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"jkl"
);
assertThat
(
environment
.
getProperty
(
"bar"
)).
isEqualTo
(
null
);
}
}
@Test
@Test
void
loadFromConfigFolderTakesPrecedenceOverHomeFolder
()
throws
Exception
{
void
loadFromConfigFolder
WithYaml
TakesPrecedenceOverHomeFolder
()
throws
Exception
{
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
properties
.
put
(
"abc"
,
"def"
);
properties
.
put
(
"abc"
,
"def"
);
new
File
(
this
.
home
+
"/.config/spring-boot"
).
mkdirs
();
properties
.
put
(
"bar"
,
"baz"
);
OutputStream
out
=
new
FileOutputStream
(
new
File
(
this
.
home
,
".spring-boot-devtools.properties"
));
writeFile
(
properties
,
".spring-boot-devtools.properties"
);
properties
.
store
(
out
,
null
);
out
.
close
();
Properties
properties2
=
new
Properties
();
Properties
properties2
=
new
Properties
();
properties2
.
put
(
"abc"
,
"jkl"
);
properties2
.
put
(
"abc"
,
"jkl"
);
OutputStream
out2
=
new
FileOutputStream
(
OutputStream
out2
=
new
FileOutputStream
(
new
File
(
this
.
home
+
"/.config/spring-boot/"
,
".spring-boot-devtools.
properties
"
));
new
File
(
this
.
home
+
"/.config/spring-boot/"
,
".spring-boot-devtools.
yml
"
));
properties2
.
store
(
out2
,
null
);
properties2
.
store
(
out2
,
null
);
out2
.
close
();
out2
.
close
();
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
ConfigurableEnvironment
environment
=
getPostProcessedEnvironment
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"jkl"
);
assertThat
(
environment
.
getProperty
(
"abc"
)).
isEqualTo
(
"jkl"
);
assertThat
(
environment
.
getProperty
(
"bar"
)).
isEqualTo
(
null
);
}
}
@Test
@Test
void
ignoresMissingHomeProperties
()
throws
Exception
{
void
ignoresMissingHomeProperties
()
throws
Exception
{
ConfigurableEnvironment
environment
=
getPostProcessedEnvironment
();
assertThat
(
environment
.
getProperty
(
"abc"
)).
isNull
();
}
private
void
writeFile
(
Properties
properties
,
String
s
)
throws
IOException
{
OutputStream
out
=
new
FileOutputStream
(
new
File
(
this
.
home
,
s
));
properties
.
store
(
out
,
null
);
out
.
close
();
}
private
ConfigurableEnvironment
getPostProcessedEnvironment
()
throws
Exception
{
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
ConfigurableEnvironment
environment
=
new
MockEnvironment
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
MockDevToolHomePropertiesPostProcessor
postProcessor
=
new
MockDevToolHomePropertiesPostProcessor
();
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
runPostProcessor
(()
->
postProcessor
.
postProcessEnvironment
(
environment
,
null
));
assertThat
(
environment
.
getProperty
(
"abc"
)).
isNull
()
;
return
environment
;
}
}
protected
void
runPostProcessor
(
Runnable
runnable
)
throws
Exception
{
protected
void
runPostProcessor
(
Runnable
runnable
)
throws
Exception
{
...
...
spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
48b5b6a2
...
@@ -431,7 +431,7 @@ Spring Boot uses a very particular `PropertySource` order that is designed to al
...
@@ -431,7 +431,7 @@ Spring Boot uses a very particular `PropertySource` order that is designed to al
sensible overriding of values. Properties are considered in the following order:
sensible overriding of values. Properties are considered in the following order:
. <<using-boot-devtools-globalsettings,Devtools global settings properties>>
. <<using-boot-devtools-globalsettings,Devtools global settings properties>>
on your home directory (`~/.spring-boot-devtools.properties` when devtools is active)
.
in the `$HOME/.config/spring-boot` folder when devtools is active
.
. {spring-javadoc}/test/context/TestPropertySource.{dc-ext}[`@TestPropertySource`]
. {spring-javadoc}/test/context/TestPropertySource.{dc-ext}[`@TestPropertySource`]
annotations on your tests.
annotations on your tests.
. `properties` attribute on your tests. Available on
. `properties` attribute on your tests. Available on
...
...
spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc
View file @
48b5b6a2
...
@@ -1018,20 +1018,30 @@ from your IDE, only the first has LiveReload support.
...
@@ -1018,20 +1018,30 @@ from your IDE, only the first has LiveReload support.
[[using-boot-devtools-globalsettings]]
[[using-boot-devtools-globalsettings]]
=== Global Settings
=== Global Settings
You can configure global devtools settings by adding a file named
You can configure global devtools settings by adding any of the following files to the `$HOME/.config/spring-boot`
`.spring-boot-devtools.properties` to your `$HOME` folder (note that the filename starts
folder (note that the filenames startswith "`.`"):
with "`.`"). Any properties added to this file apply to _all_ Spring Boot applications on
. `.spring-boot-devtools.properties`
. `.spring-boot-devtools.yaml`
. `.spring-boot-devtools.yml`
Any properties added to these file apply to _all_ Spring Boot applications on
your machine that use devtools. For example, to configure restart to always use a
your machine that use devtools. For example, to configure restart to always use a
<<using-boot-devtools-restart-triggerfile, trigger file>>, you would add the following
<<using-boot-devtools-restart-triggerfile, trigger file>>, you would add the following
property:
property:
.~/.spring-boot-devtools.properties
.~/
config/spring-boot/
.spring-boot-devtools.properties
[source,properties,indent=0]
[source,properties,indent=0]
----
----
spring.devtools.reload.trigger-file=.reloadtrigger
spring.devtools.reload.trigger-file=.reloadtrigger
----
----
NOTE: Profiles activated in `.spring-boot-devtools.properties` will not affect the
NOTE: If devtools configuration files are not found in `$HOME/.config/spring-boot`, the root of the `$HOME` folder
is searched for the presence of a `.spring-boot-devtools.properties` file. This allows you to share the devtools global
configuration with applications that are on an older version of Spring Boot that does not support the `$HOME/.config/spring-boot`
location.
NOTE: Profiles activated in the above files will not affect the
loading of <<spring-boot-features.adoc#boot-features-external-config-profile-specific-properties,
loading of <<spring-boot-features.adoc#boot-features-external-config-profile-specific-properties,
profile-specific configuration files>>.
profile-specific configuration files>>.
...
...
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