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
ae12d515
Commit
ae12d515
authored
Jun 19, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.0.x'
parents
65b0daff
deea8ebc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
10 deletions
+27
-10
ConfigFileApplicationListener.java
...rk/boot/context/config/ConfigFileApplicationListener.java
+27
-10
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
View file @
ae12d515
...
...
@@ -387,8 +387,10 @@ public class ConfigFileApplicationListener
return
;
}
if
(
this
.
activatedProfiles
)
{
this
.
logger
.
debug
(
"Profiles already activated, '"
+
profiles
+
"' will not be applied"
);
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Profiles already activated, '"
+
profiles
+
"' will not be applied"
);
}
return
;
}
this
.
profiles
.
addAll
(
profiles
);
...
...
@@ -503,23 +505,28 @@ public class ConfigFileApplicationListener
DocumentFilter
filter
,
DocumentConsumer
consumer
)
{
try
{
Resource
resource
=
this
.
resourceLoader
.
getResource
(
location
);
String
description
=
getDescription
(
location
,
resource
);
if
(
profile
!=
null
)
{
description
=
description
+
" for profile "
+
profile
;
}
if
(
resource
==
null
||
!
resource
.
exists
())
{
this
.
logger
.
trace
(
"Skipped missing config "
+
description
);
if
(
this
.
logger
.
isTraceEnabled
())
{
this
.
logger
.
trace
(
"Skipped missing config "
+
getDescription
(
location
,
resource
,
profile
));
}
return
;
}
if
(!
StringUtils
.
hasText
(
StringUtils
.
getFilenameExtension
(
resource
.
getFilename
())))
{
this
.
logger
.
trace
(
"Skipped empty config extension "
+
description
);
if
(
this
.
logger
.
isTraceEnabled
())
{
this
.
logger
.
trace
(
"Skipped empty config extension "
+
getDescription
(
location
,
resource
,
profile
));
}
return
;
}
String
name
=
"applicationConfig: ["
+
location
+
"]"
;
List
<
Document
>
documents
=
loadDocuments
(
loader
,
name
,
resource
);
if
(
CollectionUtils
.
isEmpty
(
documents
))
{
this
.
logger
.
trace
(
"Skipped unloaded config "
+
description
);
if
(
this
.
logger
.
isTraceEnabled
())
{
this
.
logger
.
trace
(
"Skipped unloaded config "
+
getDescription
(
location
,
resource
,
profile
));
}
return
;
}
List
<
Document
>
loaded
=
new
ArrayList
<>();
...
...
@@ -533,7 +540,10 @@ public class ConfigFileApplicationListener
Collections
.
reverse
(
loaded
);
if
(!
loaded
.
isEmpty
())
{
loaded
.
forEach
((
document
)
->
consumer
.
accept
(
profile
,
document
));
this
.
logger
.
debug
(
"Loaded config file "
+
description
);
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Loaded config file "
+
getDescription
(
location
,
resource
,
profile
));
}
}
}
catch
(
Exception
ex
)
{
...
...
@@ -578,6 +588,13 @@ public class ConfigFileApplicationListener
}).
collect
(
Collectors
.
toList
());
}
private
String
getDescription
(
String
location
,
Resource
resource
,
Profile
profile
)
{
String
description
=
getDescription
(
location
,
resource
);
return
(
profile
!=
null
?
description
+
" for profile "
+
profile
:
description
);
}
private
String
getDescription
(
String
location
,
Resource
resource
)
{
try
{
if
(
resource
!=
null
)
{
...
...
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