@ -360,11 +360,9 @@ public class ConfigFileApplicationListener implements
candidates . add ( LOCATION_VARIABLE ) ;
candidates . add ( LOCATION_VARIABLE ) ;
// @PropertySource annotation locations go last here (eventually highest
// @PropertySource annotation locations go last here (eventually highest
// priority). This unfortunately isn't the same semantics as @PropertySource
// priority). This unfortunately isn't the same semantics as @PropertySource
// in
// in Spring and it's hard to change that (so the property source gets added
// Spring and it's hard to change that (so the property source gets added
// again in last position by Spring later in the cycle).
// again in
addLoadCandidatesFromAnnotations ( environment , resourceLoader , candidates ) ;
// last position by Spring later in the cycle).
addLoadCandidatesFromAnnotations ( resourceLoader , candidates ) ;
this . candidates = new ArrayList < String > ( candidates ) ;
this . candidates = new ArrayList < String > ( candidates ) ;
Collections . reverse ( this . candidates ) ;
Collections . reverse ( this . candidates ) ;
}
}
@ -382,11 +380,13 @@ public class ConfigFileApplicationListener implements
}
}
}
}
private void addLoadCandidatesFromAnnotations ( ResourceLoader resourceLoader ,
private void addLoadCandidatesFromAnnotations (
ConfigurableEnvironment environment , ResourceLoader resourceLoader ,
Set < String > candidates ) {
Set < String > candidates ) {
for ( String location : ConfigFileApplicationListener . this . annotations
for ( String location : ConfigFileApplicationListener . this . annotations
. getLocations ( ) ) {
. getLocations ( ) ) {
Resource resource = resourceLoader . getResource ( location ) ;
Resource resource = resourceLoader . getResource ( environment
. resolvePlaceholders ( location ) ) ;
if ( ! ConfigFileApplicationListener . this . annotations
if ( ! ConfigFileApplicationListener . this . annotations
. ignoreResourceNotFound ( location ) & & ! resource . exists ( ) ) {
. ignoreResourceNotFound ( location ) & & ! resource . exists ( ) ) {
throw new IllegalStateException ( "Resource not found: " + location ) ;
throw new IllegalStateException ( "Resource not found: " + location ) ;