Java Code Examples for org.springframework.boot.autoconfigure.EnableAutoConfiguration

The following examples show how to use org.springframework.boot.autoconfigure.EnableAutoConfiguration. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void onAutoConfigurationImportEvent(AutoConfigurationImportEvent event) {
    // 获取当前 ClassLoader
    ClassLoader classLoader = event.getClass().getClassLoader();
    // 候选的自动装配类名单
    List<String> candidates =
            SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class, classLoader);
    // 实际的自动装配类名单
    List<String> configurations = event.getCandidateConfigurations();
    // 排除的自动装配类名单
    Set<String> exclusions = event.getExclusions();
    // 输出各自数量
    System.out.printf("自动装配类名单 - 候选数量:%d,实际数量:%d,排除数量:%s\n",
            candidates.size(), configurations.size(), exclusions.size());
    // 输出实际和排除的自动装配类名单
    System.out.println("实际的自动装配类名单:");
    event.getCandidateConfigurations().forEach(System.out::println);
    System.out.println("排除的自动装配类名单:");
    event.getExclusions().forEach(System.out::println);
}
 
Example 2
@Override
public void add(Class<?> importer, String typeName) {
	if (typeName.endsWith(".xml")) {
		this.registrars.add(new Imported(importer, typeName, context));
	}
	else {
		if (isAutoConfiguration(importer, typeName) && !context.getEnvironment()
				.getProperty(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY, Boolean.class, true)) {
			return;
		}
		this.registrars.add(new Imported(importer, typeName, context.getClassLoader()));
	}
}
 
Example 3
Source Project: butterfly   Source File: AnnotatedWithTest.java    License: MIT License 4 votes vote down vote up
@Test
public void fqdnTest() throws ParseException {
    AnnotatedWith annotatedWith = new AnnotatedWith(EnableAutoConfiguration.class);
    Assert.assertTrue(annotatedWith.evaluate(compilationUnit));
}
 
Example 4
Source Project: onetwo   Source File: SpringFactoriesLoaderTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void test(){
	List<String> names = SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class, ClassUtils.getDefaultClassLoader());
	System.out.println("names:"+names);
}