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
6fe30a8a
Commit
6fe30a8a
authored
Apr 27, 2020
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x'
Closes gh-21175
parents
2bfba4a1
36b082e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
ConfigFileApplicationListener.java
...rk/boot/context/config/ConfigFileApplicationListener.java
+3
-0
ConfigFileApplicationListenerTests.java
...ot/context/config/ConfigFileApplicationListenerTests.java
+9
-0
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
View file @
6fe30a8a
...
...
@@ -63,6 +63,7 @@ import org.springframework.core.io.DefaultResourceLoader;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.ResourceLoader
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.core.io.support.ResourcePatternResolver
;
import
org.springframework.core.io.support.SpringFactoriesLoader
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -656,6 +657,8 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
for
(
String
path
:
asResolvedSet
(
this
.
environment
.
getProperty
(
propertyName
),
null
))
{
if
(!
path
.
contains
(
"$"
))
{
path
=
StringUtils
.
cleanPath
(
path
);
Assert
.
state
(!
path
.
startsWith
(
ResourcePatternResolver
.
CLASSPATH_ALL_URL_PREFIX
),
"Classpath wildard patterns cannot be used as a search location"
);
if
(!
ResourceUtils
.
isUrl
(
path
))
{
path
=
ResourceUtils
.
FILE_URL_PREFIX
+
path
;
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java
View file @
6fe30a8a
...
...
@@ -710,6 +710,15 @@ class ConfigFileApplicationListenerTests {
matchingPropertySource
(
"applicationConfig: [file:"
+
location
.
replace
(
File
.
separatorChar
,
'/'
)
+
"]"
));
}
@Test
void
classpathWildcardResourceThrowsException
()
{
TestPropertySourceUtils
.
addInlinedPropertiesToEnvironment
(
this
.
environment
,
"spring.config.location=classpath*:override.properties"
);
assertThatIllegalStateException
()
.
isThrownBy
(()
->
this
.
initializer
.
postProcessEnvironment
(
this
.
environment
,
this
.
application
))
.
withMessage
(
"Classpath wildard patterns cannot be used as a search location"
);
}
@Test
void
propertySourceAnnotation
()
{
SpringApplication
application
=
new
SpringApplication
(
WithPropertySource
.
class
);
...
...
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