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
507c4ec7
Commit
507c4ec7
authored
Aug 22, 2013
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code formatting
parent
0f012c58
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
19 deletions
+23
-19
BeanDefinitionLoader.java
...n/java/org/springframework/boot/BeanDefinitionLoader.java
+22
-18
SpringApplicationTests.java
...java/org/springframework/boot/SpringApplicationTests.java
+1
-1
No files found.
spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java
View file @
507c4ec7
...
@@ -154,7 +154,8 @@ class BeanDefinitionLoader {
...
@@ -154,7 +154,8 @@ class BeanDefinitionLoader {
}
}
private
int
load
(
CharSequence
source
)
{
private
int
load
(
CharSequence
source
)
{
String
sourceString
=
xmlReader
.
getEnvironment
().
resolvePlaceholders
(
source
.
toString
());
String
sourceString
=
this
.
xmlReader
.
getEnvironment
().
resolvePlaceholders
(
source
.
toString
());
try
{
try
{
// Use class utils so that period separated nested class names work
// Use class utils so that period separated nested class names work
return
load
(
ClassUtils
.
forName
(
sourceString
,
null
));
return
load
(
ClassUtils
.
forName
(
sourceString
,
null
));
...
@@ -163,37 +164,40 @@ class BeanDefinitionLoader {
...
@@ -163,37 +164,40 @@ class BeanDefinitionLoader {
// swallow exception and continue
// swallow exception and continue
}
}
ResourceLoader
loader
=
this
.
resourceLoader
!=
null
?
ResourceLoader
loader
=
this
.
resourceLoader
!=
null
?
this
.
resourceLoader
this
.
resourceLoader
:
DEFAULT_RESOURCE_LOADER
;
:
DEFAULT_RESOURCE_LOADER
;
int
loadCount
=
0
;
int
loadCount
=
0
;
if
(
loader
instanceof
ResourcePatternResolver
)
{
if
(
loader
instanceof
ResourcePatternResolver
)
{
// Resource pattern matching available.
// Resource pattern matching available.
try
{
try
{
Resource
[]
resources
=
((
ResourcePatternResolver
)
loader
).
getResources
(
sourceString
);
Resource
[]
resources
=
((
ResourcePatternResolver
)
loader
)
for
(
Resource
resource
:
resources
)
{
.
getResources
(
sourceString
);
if
(
resource
.
exists
()
)
{
for
(
Resource
resource
:
resources
)
{
if
(
resource
.
exists
())
{
loadCount
+=
load
(
resource
);
loadCount
+=
load
(
resource
);
}
}
}
}
}
}
catch
(
IOException
ex
)
{
catch
(
IOException
ex
)
{
throw
new
BeanDefinitionStoreException
(
throw
new
BeanDefinitionStoreException
(
"Could not resolve bean definition resource pattern ["
+
sourceString
+
"]"
,
ex
);
"Could not resolve bean definition resource pattern ["
+
sourceString
+
"]"
,
ex
);
}
}
}
}
if
(
!(
loader
instanceof
ResourcePatternResolver
)
)
{
if
(!(
loader
instanceof
ResourcePatternResolver
)
)
{
// Can only load single resources by absolute URL.
// Can only load single resources by absolute URL.
Resource
loadedResource
=
loader
.
getResource
(
sourceString
);
Resource
loadedResource
=
loader
.
getResource
(
sourceString
);
if
(
loadedResource
!=
null
&&
loadedResource
.
exists
())
{
if
(
loadedResource
!=
null
&&
loadedResource
.
exists
())
{
return
load
(
loadedResource
);
return
load
(
loadedResource
);
}
}
}
}
if
(
loadCount
>
0
)
{
if
(
loadCount
>
0
)
{
return
loadCount
;
return
loadCount
;
}
}
else
{
else
{
// Attempt to treat the source as a package name, common to all PatternResolver types
// Attempt to treat the source as a package name, common to all
// PatternResolver types
Package
packageResource
=
findPackage
(
source
);
Package
packageResource
=
findPackage
(
source
);
if
(
packageResource
!=
null
)
{
if
(
packageResource
!=
null
)
{
return
load
(
packageResource
);
return
load
(
packageResource
);
...
...
spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
View file @
507c4ec7
...
@@ -275,7 +275,7 @@ public class SpringApplicationTests {
...
@@ -275,7 +275,7 @@ public class SpringApplicationTests {
application
,
"initialSources"
);
application
,
"initialSources"
);
assertThat
(
initialSources
.
toArray
(),
equalTo
(
sources
));
assertThat
(
initialSources
.
toArray
(),
equalTo
(
sources
));
}
}
@Test
@Test
public
void
wildcardSources
()
{
public
void
wildcardSources
()
{
Object
[]
sources
=
{
"classpath:org/springframework/boot/sample-${sample.app.test.prop}.xml"
};
Object
[]
sources
=
{
"classpath:org/springframework/boot/sample-${sample.app.test.prop}.xml"
};
...
...
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