当前位置: 首页>>代码示例>>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;未经允许,请勿转载。