Java 类org.springframework.boot.autoconfigure.AutoConfigurationPackages 实例源码

项目:mybatisplus-boot-starter    文件:MybatisPlusAutoConfiguration.java   
@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);
    }
}
项目:mapper-boot-starter    文件:MapperAutoConfiguration.java   
@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);
    }
}
项目:loc-framework    文件:LocMybatisAutoConfiguration.java   
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);
  }
}
项目:mybatis-plus    文件:MybatisPlusAutoConfiguration.java   
@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);
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CassandraDataAutoConfigurationIntegrationTests.java   
@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);
}
项目:spring-boot-starter    文件:MybatisAutoConfiguration.java   
@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);
  }
}
项目:winlet    文件:DaoScanAutoConfiguration.java   
@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;
}
项目:azure-spring-boot    文件:TestAutoConfigurationPackageRegistrar.java   
@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")));
}
项目:dubbo-spring-boot-autoconfig    文件:AutoConfiguredDubboScannerRegistrar.java   
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
    List<String> packages = AutoConfigurationPackages.get(beanFactory);

    registerDubboService(packages, registry);

    registerDubboReference(registry);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Neo4jDataAutoConfiguration.java   
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()]);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CassandraDataAutoConfiguration.java   
@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;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EntityScanner.java   
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;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JpaBaseConfiguration.java   
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()]);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MongoDataAutoConfigurationTests.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Neo4jDataAutoConfigurationTests.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CassandraDataAutoConfigurationIntegrationTests.java   
@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);
}
项目:spring-boot-concourse    文件:MongoDataAutoConfiguration.java   
private static Collection<String> getMappingBasePackages(BeanFactory beanFactory) {
    try {
        return AutoConfigurationPackages.get(beanFactory);
    }
    catch (IllegalStateException ex) {
        // no auto-configuration package registered yet
        return Collections.emptyList();
    }
}
项目:spring-boot-concourse    文件:Neo4jAutoConfiguration.java   
protected String[] getPackagesToScan() {
    if (AutoConfigurationPackages.has(this.beanFactory)) {
        List<String> basePackages = AutoConfigurationPackages
                .get(this.beanFactory);
        return basePackages.toArray(new String[basePackages.size()]);
    }
    return new String[0];
}
项目:spring-boot-concourse    文件:JpaBaseConfiguration.java   
protected String[] getPackagesToScan() {
    if (AutoConfigurationPackages.has(this.beanFactory)) {
        List<String> basePackages = AutoConfigurationPackages.get(this.beanFactory);
        return basePackages.toArray(new String[basePackages.size()]);
    }
    return NO_PACKAGES;
}
项目:spring-boot-concourse    文件:MongoDataAutoConfigurationTests.java   
@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);
}
项目:spring-boot-concourse    文件:Neo4jDataAutoConfigurationTests.java   
@Test
public void usesAutoConfigurationPackageToPickUpDomainTypes() {
    String cityPackage = City.class.getPackage().getName();
    AutoConfigurationPackages.register(this.context, cityPackage);
    this.context.register(Neo4jAutoConfiguration.class);
    this.context.refresh();
    assertDomainTypesDiscovered(this.context.getBean(Neo4jMappingContext.class),
            City.class);
}
项目:contestparser    文件:MongoDataAutoConfiguration.java   
private static Collection<String> getMappingBasePackages(BeanFactory beanFactory) {
    try {
        return AutoConfigurationPackages.get(beanFactory);
    }
    catch (IllegalStateException ex) {
        // no auto-configuration package registered yet
        return Collections.emptyList();
    }
}
项目:contestparser    文件:JpaBaseConfiguration.java   
protected String[] getPackagesToScan() {
    if (AutoConfigurationPackages.has(this.beanFactory)) {
        List<String> basePackages = AutoConfigurationPackages.get(this.beanFactory);
        return basePackages.toArray(new String[basePackages.size()]);
    }
    return NO_PACKAGES;
}
项目:contestparser    文件:MongoDataAutoConfigurationTests.java   
@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);
}
项目:flipper-reverse-image-search    文件:CassandraDataAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
public CassandraMappingContext cassandraMapping() throws ClassNotFoundException {
    BasicCassandraMappingContext bean = new BasicCassandraMappingContext();
    bean.setInitialEntitySet(CassandraEntityClassScanner.scan(AutoConfigurationPackages.get(beanFactory)));
    bean.setBeanClassLoader(beanFactory.getClass().getClassLoader());
    return bean;
}
项目:wicket-spring-boot    文件:ClassCandidateScanner.java   
private static Collection<String> getMappingBasePackages(BeanFactory beanFactory) {
    try {
        return AutoConfigurationPackages.get(beanFactory);
    }
    catch (IllegalStateException ex) {
        // no auto-configuration package registered yet
        return Collections.emptyList();
    }
}
项目:resteasy-spring-boot    文件:JaxrsAppRegistrationTest.java   
@BeforeMethod
public void beforeTest() {
    PowerMockito.mockStatic(AutoConfigurationPackages.class);
    List<String> packages = new ArrayList<String>();
    packages.add("com.paypal.springboot.resteasy.sample");
    PowerMockito.when(AutoConfigurationPackages.get(any(BeanFactory.class))).thenReturn(packages);
}
项目:spring-domain-events    文件:DomainEventsAutoConfiguration.java   
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
    AutoConfigurationPackages.register(registry, EventPublication.class.getPackage().getName());
}
项目:java-restify    文件:RestifyAutoConfiguration.java   
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
    doScan(AutoConfigurationPackages.get(beanFactory), scanner, registry);
}
项目:java-restify    文件:RestifyAutoConfigurationTest.java   
@Override
public void registerBeanDefinitions(AnnotationMetadata arg0, BeanDefinitionRegistry registry) {
    AutoConfigurationPackages.register(registry, RestifyAutoConfigurationTest.class.getPackage().getName());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:AbstractRepositoryConfigurationSourceSupport.java   
protected Iterable<String> getBasePackages() {
    return AutoConfigurationPackages.get(this.beanFactory);
}
项目:spring-content    文件:MongoContentAutoConfigureRegistrar.java   
protected String[] getBasePackages() {
    return AutoConfigurationPackages.get(this.getBeanFactory()).toArray(new String[] {});
}
项目:spring-content    文件:JpaContentAutoConfigureRegistrar.java   
protected String[] getBasePackages() {
    return AutoConfigurationPackages.get(this.getBeanFactory()).toArray(new String[] {});
}
项目:spring-content    文件:FilesystemContentAutoConfigureRegistrar.java   
protected String[] getBasePackages() {
    return AutoConfigurationPackages.get(this.getBeanFactory()).toArray(new String[] {});
}
项目:spring-content    文件:S3ContentAutoConfigureRegistrar.java   
protected String[] getBasePackages() {
    return AutoConfigurationPackages.get(this.getBeanFactory()).toArray(new String[] {});
}
项目:spring-boot-concourse    文件:AbstractRepositoryConfigurationSourceSupport.java   
protected Iterable<String> getBasePackages() {
    return AutoConfigurationPackages.get(this.beanFactory);
}
项目:contestparser    文件:AbstractRepositoryConfigurationSourceSupport.java   
protected Iterable<String> getBasePackages() {
    return AutoConfigurationPackages.get(this.beanFactory);
}