本文整理汇总了Java中org.springframework.boot.autoconfigure.AutoConfigurationPackages类的典型用法代码示例。如果您正苦于以下问题:Java AutoConfigurationPackages类的具体用法?Java AutoConfigurationPackages怎么用?Java AutoConfigurationPackages使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AutoConfigurationPackages类属于org.springframework.boot.autoconfigure包,在下文中一共展示了AutoConfigurationPackages类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerBeanDefinitions
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
logger.debug("Searching for mappers annotated with @Mapper");
ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry);
try {
if (this.resourceLoader != null) {
scanner.setResourceLoader(this.resourceLoader);
}
List<String> packages = AutoConfigurationPackages.get(this.beanFactory);
if (logger.isDebugEnabled()) {
for (String pkg : packages) {
logger.debug("Using auto-configuration base package '" + pkg + "'");
}
}
scanner.setAnnotationClass(Mapper.class);
scanner.registerFilters();
scanner.doScan(StringUtils.toStringArray(packages));
} catch (IllegalStateException ex) {
logger.debug("Could not determine auto-configuration package, automatic mapper scanning disabled." + ex);
}
}
示例2: registerBeanDefinitions
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
logger.debug("Searching for mappers annotated with @Mapper");
ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry);
scanner.setMapperProperties(environment);
try {
if (this.resourceLoader != null) {
scanner.setResourceLoader(this.resourceLoader);
}
List<String> packages = AutoConfigurationPackages.get(this.beanFactory);
if (logger.isDebugEnabled()) {
for (String pkg : packages) {
logger.debug("Using auto-configuration base package '{}'", pkg);
}
}
scanner.setAnnotationClass(Mapper.class);
scanner.registerFilters();
scanner.doScan(StringUtils.toStringArray(packages));
} catch (IllegalStateException ex) {
logger.debug("Could not determine auto-configuration package, automatic mapper scanning disabled.", ex);
}
}
示例3: createClassPathMapperScanner
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
private void createClassPathMapperScanner(BeanDefinitionRegistry registry, String prefixName) {
ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry);
try {
if (this.resourceLoader != null) {
scanner.setResourceLoader(this.resourceLoader);
}
List<String> packages = AutoConfigurationPackages.get(beanFactory);
packages.forEach(pkg -> log.info("Using auto-configuration base package '{}'", pkg));
scanner.setAnnotationClass(Mapper.class);
scanner.setSqlSessionFactoryBeanName(prefixName + "SessionFactory");
scanner.registerFilters();
scanner.doScan(StringUtils.toStringArray(packages));
} catch (IllegalStateException ex) {
log.info("Could not determine auto-configuration package", ex);
}
}
示例4: hasRecreateSchemaActionSet
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Test
public void hasRecreateSchemaActionSet() {
createTestKeyspaceIfNotExists();
this.context = new AnnotationConfigApplicationContext();
String cityPackage = City.class.getPackage().getName();
AutoConfigurationPackages.register(this.context, cityPackage);
EnvironmentTestUtils.addEnvironment(this.context,
"spring.data.cassandra.schemaAction:RECREATE_DROP_UNUSED",
"spring.data.cassandra.keyspaceName:boot_test");
this.context.register(CassandraAutoConfiguration.class,
CassandraDataAutoConfiguration.class);
this.context.refresh();
CassandraSessionFactoryBean bean = this.context
.getBean(CassandraSessionFactoryBean.class);
assertThat(bean.getSchemaAction()).isEqualTo(SchemaAction.RECREATE_DROP_UNUSED);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:CassandraDataAutoConfigurationIntegrationTests.java
示例5: registerBeanDefinitions
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
logger.debug("Searching for mappers annotated with @Mapper");
ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry);
try {
if (this.resourceLoader != null) {
scanner.setResourceLoader(this.resourceLoader);
}
List<String> packages = AutoConfigurationPackages.get(this.beanFactory);
if (logger.isDebugEnabled()) {
packages.forEach(pkg -> logger.debug("Using auto-configuration base package '{}'", pkg));
}
scanner.setAnnotationClass(Mapper.class);
scanner.registerFilters();
scanner.doScan(StringUtils.toStringArray(packages));
} catch (IllegalStateException ex) {
logger.debug("Could not determine auto-configuration package, automatic mapper scanning disabled.", ex);
}
}
示例6: getScannerConfigurer
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Bean
public DaoScannerConfigurer getScannerConfigurer() {
// Try to use @EnableAutoConfiguration base packages
List<String> basePackages = null;
try {
basePackages = AutoConfigurationPackages.get(context);
} catch (Exception e) {
}
if (basePackages == null || basePackages.size() == 0)
return null;
DaoScannerConfigurer cfg = new DaoScannerConfigurer();
cfg.setBasePackage(basePackages.stream().collect(
Collectors.joining(",")));
return cfg;
}
示例7: registerBeanDefinitions
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata,
BeanDefinitionRegistry registry) {
final AnnotationAttributes attributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(
TestAutoConfigurationPackage.class.getName(), true));
AutoConfigurationPackages.register(registry,
ClassUtils.getPackageName(attributes.getString("value")));
}
示例8: registerBeanDefinitions
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
List<String> packages = AutoConfigurationPackages.get(beanFactory);
registerDubboService(packages, registry);
registerDubboReference(registry);
}
开发者ID:justice-code,项目名称:dubbo-spring-boot-autoconfig,代码行数:9,代码来源:AutoConfiguredDubboScannerRegistrar.java
示例9: getPackagesToScan
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
private String[] getPackagesToScan() {
List<String> packages = EntityScanPackages.get(this.applicationContext)
.getPackageNames();
if (packages.isEmpty()
&& AutoConfigurationPackages.has(this.applicationContext)) {
packages = AutoConfigurationPackages.get(this.applicationContext);
}
return packages.toArray(new String[packages.size()]);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:Neo4jDataAutoConfiguration.java
示例10: cassandraMapping
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public CassandraMappingContext cassandraMapping() throws ClassNotFoundException {
BasicCassandraMappingContext context = new BasicCassandraMappingContext();
List<String> packages = EntityScanPackages.get(this.beanFactory)
.getPackageNames();
if (packages.isEmpty() && AutoConfigurationPackages.has(this.beanFactory)) {
packages = AutoConfigurationPackages.get(this.beanFactory);
}
if (!packages.isEmpty()) {
context.setInitialEntitySet(CassandraEntityClassScanner.scan(packages));
}
return context;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:CassandraDataAutoConfiguration.java
示例11: getPackages
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
private List<String> getPackages() {
List<String> packages = EntityScanPackages.get(this.context).getPackageNames();
if (packages.isEmpty() && AutoConfigurationPackages.has(this.context)) {
packages = AutoConfigurationPackages.get(this.context);
}
return packages;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:EntityScanner.java
示例12: getPackagesToScan
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
protected String[] getPackagesToScan() {
List<String> packages = EntityScanPackages.get(this.beanFactory)
.getPackageNames();
if (packages.isEmpty() && AutoConfigurationPackages.has(this.beanFactory)) {
packages = AutoConfigurationPackages.get(this.beanFactory);
}
return packages.toArray(new String[packages.size()]);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:JpaBaseConfiguration.java
示例13: usesAutoConfigurationPackageToPickUpDocumentTypes
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Test
public void usesAutoConfigurationPackageToPickUpDocumentTypes() {
this.context = new AnnotationConfigApplicationContext();
String cityPackage = City.class.getPackage().getName();
AutoConfigurationPackages.register(this.context, cityPackage);
this.context.register(MongoAutoConfiguration.class,
MongoDataAutoConfiguration.class);
this.context.refresh();
assertDomainTypesDiscovered(this.context.getBean(MongoMappingContext.class),
City.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:MongoDataAutoConfigurationTests.java
示例14: usesAutoConfigurationPackageToPickUpDomainTypes
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Test
public void usesAutoConfigurationPackageToPickUpDomainTypes() {
this.context = new AnnotationConfigApplicationContext();
String cityPackage = City.class.getPackage().getName();
AutoConfigurationPackages.register(this.context, cityPackage);
this.context.register(Neo4jDataAutoConfiguration.class);
this.context.refresh();
assertDomainTypesDiscovered(this.context.getBean(Neo4jMappingContext.class),
City.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:Neo4jDataAutoConfigurationTests.java
示例15: hasDefaultSchemaActionSet
import org.springframework.boot.autoconfigure.AutoConfigurationPackages; //导入依赖的package包/类
@Test
public void hasDefaultSchemaActionSet() {
this.context = new AnnotationConfigApplicationContext();
String cityPackage = City.class.getPackage().getName();
AutoConfigurationPackages.register(this.context, cityPackage);
this.context.register(CassandraAutoConfiguration.class,
CassandraDataAutoConfiguration.class);
this.context.refresh();
CassandraSessionFactoryBean bean = this.context
.getBean(CassandraSessionFactoryBean.class);
assertThat(bean.getSchemaAction()).isEqualTo(SchemaAction.NONE);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:CassandraDataAutoConfigurationIntegrationTests.java