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
909dc374
Commit
909dc374
authored
Jun 23, 2015
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.2.x'
parents
dc7d1709
80deaf64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
ConfigFileApplicationListener.java
...rk/boot/context/config/ConfigFileApplicationListener.java
+4
-3
ConfigFileApplicationListenerTests.java
...ot/context/config/ConfigFileApplicationListenerTests.java
+10
-0
No files found.
spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
View file @
909dc374
...
@@ -54,6 +54,7 @@ import org.springframework.core.io.DefaultResourceLoader;
...
@@ -54,6 +54,7 @@ import org.springframework.core.io.DefaultResourceLoader;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.ResourceLoader
;
import
org.springframework.core.io.ResourceLoader
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ResourceUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.validation.BindException
;
import
org.springframework.validation.BindException
;
...
@@ -455,10 +456,10 @@ public class ConfigFileApplicationListener implements
...
@@ -455,10 +456,10 @@ public class ConfigFileApplicationListener implements
for
(
String
path
:
asResolvedSet
(
for
(
String
path
:
asResolvedSet
(
this
.
environment
.
getProperty
(
CONFIG_LOCATION_PROPERTY
),
null
))
{
this
.
environment
.
getProperty
(
CONFIG_LOCATION_PROPERTY
),
null
))
{
if
(!
path
.
contains
(
"$"
))
{
if
(!
path
.
contains
(
"$"
))
{
if
(!
path
.
contains
(
":"
))
{
path
=
"file:"
+
path
;
}
path
=
StringUtils
.
cleanPath
(
path
);
path
=
StringUtils
.
cleanPath
(
path
);
if
(!
ResourceUtils
.
isUrl
(
path
))
{
path
=
ResourceUtils
.
FILE_URL_PREFIX
+
path
;
}
}
}
locations
.
add
(
path
);
locations
.
add
(
path
);
}
}
...
...
spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java
View file @
909dc374
...
@@ -458,6 +458,16 @@ public class ConfigFileApplicationListenerTests {
...
@@ -458,6 +458,16 @@ public class ConfigFileApplicationListenerTests {
+
location
+
"]"
));
+
location
+
"]"
));
}
}
@Test
public
void
absoluteResourceDefaultsToFile
()
throws
Exception
{
String
location
=
new
File
(
"src/test/resources/specificlocation.properties"
).
getAbsolutePath
();
EnvironmentTestUtils
.
addEnvironment
(
this
.
environment
,
"spring.config.location:"
+
location
);
this
.
initializer
.
onApplicationEvent
(
this
.
event
);
assertThat
(
this
.
environment
,
containsPropertySource
(
"applicationConfig: [file:"
+
location
.
replace
(
File
.
separatorChar
,
'/'
)
+
"]"
));
}
@Test
@Test
public
void
propertySourceAnnotation
()
throws
Exception
{
public
void
propertySourceAnnotation
()
throws
Exception
{
SpringApplication
application
=
new
SpringApplication
(
WithPropertySource
.
class
);
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