Add check for non empty list of factories

It was seeen that if a different plugin was used to package Spring Boot
that the project would load but no autoconfiguration actually took
place and many features were mysteriously not working.  Adding a check
to ensure that some factories are always loaded as this is expected.

Closes gh-5465
This commit is contained in:
Rob Baily 2016-03-28 09:46:31 -04:00 committed by Stephane Nicoll
parent 1b8f44ae2a
commit 971a7194d8
1 changed files with 4 additions and 1 deletions

View File

@ -140,8 +140,11 @@ public class EnableAutoConfigurationImportSelector
*/
protected List<String> getCandidateConfigurations(AnnotationMetadata metadata,
AnnotationAttributes attributes) {
return SpringFactoriesLoader.loadFactoryNames(
List<String> configurations = SpringFactoriesLoader.loadFactoryNames(
getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader());
Assert.notEmpty(configurations,
"No auto configuration factories available. Please check your packaging to assure that the META-INF/spring.factories file is correct.");
return configurations;
}
/**