protected ConditionOutcome getResourceOutcome ( ConditionContext context , AnnotatedTypeMetadata metadata ) { List < String > found = new ArrayList <> ( ) ; for ( String location : this . resourceLocations ) { Resource resource = context . getResourceLoader ( ) . getResource ( location ) ; if ( resource != null && resource . exists ( ) ) { found . add ( location ) ; } } if ( found . isEmpty ( ) ) { ConditionMessage message = startConditionMessage ( ) . didNotFind ( "resource" , "resources" ) . items ( Style . QUOTE , Arrays . asList ( this . resourceLocations ) ) ; return ConditionOutcome . noMatch ( message ) ; } ConditionMessage message = startConditionMessage ( ) . found ( "resource" , "resources" ) . items ( Style . QUOTE , found ) ; return ConditionOutcome . match ( message ) ; }
Check if one of the default resource locations actually exists .