當前位置: 首頁>>代碼示例>>Java>>正文


Java EnableAutoConfiguration類代碼示例

本文整理匯總了Java中org.springframework.boot.autoconfigure.EnableAutoConfiguration的典型用法代碼示例。如果您正苦於以下問題:Java EnableAutoConfiguration類的具體用法?Java EnableAutoConfiguration怎麽用?Java EnableAutoConfiguration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EnableAutoConfiguration類屬於org.springframework.boot.autoconfigure包,在下文中一共展示了EnableAutoConfiguration類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getApplicationPackageName

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
/**
 * Return root package of spring boot application.
 *
 * @param applicationContext
 * @return list of packages
 */
public static List<String> getApplicationPackageName(final ApplicationContext applicationContext) {

    Set<String> candidateClasses = new HashSet<>();
    candidateClasses.addAll(Arrays.asList(applicationContext.getBeanNamesForAnnotation(SpringBootApplication.class)));
    candidateClasses.addAll(Arrays.asList(applicationContext.getBeanNamesForAnnotation(EnableAutoConfiguration.class)));
    candidateClasses.addAll(Arrays.asList(applicationContext.getBeanNamesForAnnotation(ComponentScan.class)));

    if (candidateClasses.isEmpty()) {
        throw new RuntimeException("Is mandatory for the starter have @SpringBootApplication, @EnableAutoConfiguration or @ComponentScan annotation");
    } else {
        return candidateClasses.parallelStream()
                .map(candidateClazz -> applicationContext.getBean(candidateClazz).getClass().getPackage().getName())
                .distinct()
                .collect(Collectors.toList());
    }

}
 
開發者ID:ganchix,項目名稱:morphia-spring-boot-starter,代碼行數:24,代碼來源:MorphiaUtils.java

示例2: springBootUseSpringBootApplicationGroovy

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Test
public void springBootUseSpringBootApplicationGroovy() {
	ProjectRequest request = createProjectRequest("web");
	request.setLanguage("groovy");
	request.setBootVersion("1.2.0.RC1");
	request.setName("MyDemo");
	request.setPackageName("foo");
	generateProject(request)
			.sourceCodeAssert("src/main/groovy/foo/MyDemoApplication.groovy")
			.hasImports(SpringBootApplication.class.getName())
			.doesNotHaveImports(EnableAutoConfiguration.class.getName(),
					ComponentScan.class.getName(), Configuration.class.getName())
			.contains("@SpringBootApplication").doesNotContain(
					"@EnableAutoConfiguration", "@Configuration", "@ComponentScan");
}
 
開發者ID:spring-io,項目名稱:initializr,代碼行數:16,代碼來源:ProjectGeneratorTests.java

示例3: test02

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Test
public void test02() {
    List<String> classes = SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class, this.getClass().getClassLoader());
    classes.forEach(clazz -> {
        System.out.println("==== " + clazz);
    });
}
 
開發者ID:fangjian0423,項目名稱:springboot-analysis,代碼行數:8,代碼來源:LoadTest.java

示例4: init

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Override
public void init(AuthenticationManagerBuilder auth) {
	Map<String, Object> beansWithAnnotation = this.context
			.getBeansWithAnnotation(EnableAutoConfiguration.class);
	if (logger.isDebugEnabled()) {
		logger.debug("Eagerly initializing " + beansWithAnnotation);
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:9,代碼來源:BootGlobalAuthenticationConfiguration.java

示例5: springBoot11UseEnableAutoConfigurationJava

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Test
public void springBoot11UseEnableAutoConfigurationJava() {
	ProjectRequest request = createProjectRequest("web");
	request.setBootVersion("1.1.9.RELEASE");
	request.setName("MyDemo");
	request.setPackageName("foo");
	generateProject(request)
			.sourceCodeAssert("src/main/java/foo/MyDemoApplication.java")
			.hasImports(EnableAutoConfiguration.class.getName(),
					ComponentScan.class.getName(), Configuration.class.getName())
			.doesNotHaveImports(SpringBootApplication.class.getName())
			.contains("@EnableAutoConfiguration", "@Configuration", "@ComponentScan")
			.doesNotContain("@SpringBootApplication");
}
 
開發者ID:spring-io,項目名稱:initializr,代碼行數:15,代碼來源:ProjectGeneratorTests.java

示例6: springBootUseSpringBootApplicationJava

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Test
public void springBootUseSpringBootApplicationJava() {
	ProjectRequest request = createProjectRequest("web");
	request.setBootVersion("1.2.0.RC1");
	request.setName("MyDemo");
	request.setPackageName("foo");
	generateProject(request)
			.sourceCodeAssert("src/main/java/foo/MyDemoApplication.java")
			.hasImports(SpringBootApplication.class.getName())
			.doesNotHaveImports(EnableAutoConfiguration.class.getName(),
					ComponentScan.class.getName(), Configuration.class.getName())
			.contains("@SpringBootApplication").doesNotContain(
					"@EnableAutoConfiguration", "@Configuration", "@ComponentScan");
}
 
開發者ID:spring-io,項目名稱:initializr,代碼行數:15,代碼來源:ProjectGeneratorTests.java

示例7: springBoot11UseEnableAutoConfigurationGroovy

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Test
public void springBoot11UseEnableAutoConfigurationGroovy() {
	ProjectRequest request = createProjectRequest("web");
	request.setLanguage("groovy");
	request.setBootVersion("1.1.9.RELEASE");
	request.setName("MyDemo");
	request.setPackageName("foo");
	generateProject(request)
			.sourceCodeAssert("src/main/groovy/foo/MyDemoApplication.groovy")
			.hasImports(EnableAutoConfiguration.class.getName(),
					ComponentScan.class.getName(), Configuration.class.getName())
			.doesNotHaveImports(SpringBootApplication.class.getName())
			.contains("@EnableAutoConfiguration", "@Configuration", "@ComponentScan")
			.doesNotContain("@SpringBootApplication");
}
 
開發者ID:spring-io,項目名稱:initializr,代碼行數:16,代碼來源:ProjectGeneratorTests.java

示例8: springBoot11UseEnableAutoConfigurationKotlin

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Test
public void springBoot11UseEnableAutoConfigurationKotlin() {
	ProjectRequest request = createProjectRequest("web");
	request.setLanguage("kotlin");
	request.setBootVersion("1.1.9.RELEASE");
	request.setName("MyDemo");
	request.setPackageName("foo");
	generateProject(request)
			.sourceCodeAssert("src/main/kotlin/foo/MyDemoApplication.kt")
			.hasImports(EnableAutoConfiguration.class.getName(),
					ComponentScan.class.getName(), Configuration.class.getName())
			.doesNotHaveImports(SpringBootApplication.class.getName())
			.contains("@EnableAutoConfiguration", "@Configuration", "@ComponentScan")
			.doesNotContain("@SpringBootApplication");
}
 
開發者ID:spring-io,項目名稱:initializr,代碼行數:16,代碼來源:ProjectGeneratorTests.java

示例9: springBootUseSpringBootApplicationKotlin

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Test
public void springBootUseSpringBootApplicationKotlin() {
	ProjectRequest request = createProjectRequest("web");
	request.setLanguage("kotlin");
	request.setBootVersion("1.2.0.RC1");
	request.setName("MyDemo");
	request.setPackageName("foo");
	generateProject(request)
			.sourceCodeAssert("src/main/kotlin/foo/MyDemoApplication.kt")
			.hasImports(SpringBootApplication.class.getName())
			.doesNotHaveImports(EnableAutoConfiguration.class.getName(),
					ComponentScan.class.getName(), Configuration.class.getName())
			.contains("@SpringBootApplication").doesNotContain(
					"@EnableAutoConfiguration", "@Configuration", "@ComponentScan");
}
 
開發者ID:spring-io,項目名稱:initializr,代碼行數:16,代碼來源:ProjectGeneratorTests.java

示例10: fqdnTest

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Test
public void fqdnTest() throws ParseException {
    AnnotatedWith annotatedWith = new AnnotatedWith(EnableAutoConfiguration.class);
    Assert.assertTrue(annotatedWith.evaluate(compilationUnit));
}
 
開發者ID:paypal,項目名稱:butterfly,代碼行數:6,代碼來源:AnnotatedWithTest.java

示例11: customizeContext

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Override
public void customizeContext(ConfigurableApplicationContext context,
		MergedContextConfiguration mergedConfig) {
	EnvironmentTestUtils.addEnvironment(context,
			EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY + "=false");
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:7,代碼來源:OverrideAutoConfigurationContextCustomizerFactory.java

示例12: test

import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //導入依賴的package包/類
@Test
public void test(){
	List<String> names = SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class, ClassUtils.getDefaultClassLoader());
	System.out.println("names:"+names);
}
 
開發者ID:wayshall,項目名稱:onetwo,代碼行數:6,代碼來源:SpringFactoriesLoaderTest.java


注:本文中的org.springframework.boot.autoconfigure.EnableAutoConfiguration類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。