org.springframework.context.annotation.ImportSelector Java Examples
The following examples show how to use
org.springframework.context.annotation.ImportSelector.
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
Source File: ServerImportBeanDefinitionRegistrar.java From thinking-in-spring-boot-samples with Apache License 2.0 | 5 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { // 复用 {@link ServerImportSelector} 实现,避免重复劳动 ImportSelector importSelector = new ServerImportSelector(); // 筛选 Class 名称集合 String[] selectedClassNames = importSelector.selectImports(importingClassMetadata); // 创建 Bean 定义 Stream.of(selectedClassNames) .map(BeanDefinitionBuilder::genericBeanDefinition) // 转化为 BeanDefinitionBuilder 对象 .map(BeanDefinitionBuilder::getBeanDefinition) // 转化为 BeanDefinition .forEach(beanDefinition -> // 注册 BeanDefinition 到 BeanDefinitionRegistry BeanDefinitionReaderUtils.registerWithGeneratedName(beanDefinition, registry) ); }
Example #2
Source File: FunctionalInstallerImportRegistrars.java From spring-init with Apache License 2.0 | 5 votes |
private String[] selected(ImportSelector registrar, Class<?> importer) { if (registrar instanceof DeferredImportSelector) { return new DeferredConfigurations(Stream.of(registrar.selectImports(getMetaData(importer))) .map(name -> ClassUtils.resolveClassName(name, context.getClassLoader())) .collect(Collectors.toList())).list(); } return registrar.selectImports(getMetaData(importer)); }
Example #3
Source File: Type.java From spring-boot-graal-feature with Apache License 2.0 | 4 votes |
private boolean implementsImportSelector() { return implementsInterface(fromLdescriptorToSlashed(ImportSelector)); }