Here are the examples of the java api org.springframework.core.type.AnnotationMetadata taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
454 Examples
19
View Source File : CustomizeImportSelector3.java
License : Apache License 2.0
Project Creator : zq2599
License : Apache License 2.0
Project Creator : zq2599
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
System.out.println("selectImports : " + this.getClreplaced().getSimpleName());
return new String[] { "com.bolingcavalry.customizeimportselector.service.impl.CustomizeServiceImpl3" };
}
19
View Source File : CustomizeImportSelector2.java
License : Apache License 2.0
Project Creator : zq2599
License : Apache License 2.0
Project Creator : zq2599
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
System.out.println("selectImports : " + this.getClreplaced().getSimpleName());
return new String[] { "com.bolingcavalry.customizeimportselector.service.impl.CustomizeServiceImpl2" };
}
19
View Source File : CustomizeImportSelector1.java
License : Apache License 2.0
Project Creator : zq2599
License : Apache License 2.0
Project Creator : zq2599
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
System.out.println("selectImports : " + this.getClreplaced().getSimpleName());
return new String[] { "com.bolingcavalry.customizeimportselector.service.impl.CustomizeServiceImpl1" };
}
19
View Source File : CustomizeImportSelector.java
License : Apache License 2.0
Project Creator : zq2599
License : Apache License 2.0
Project Creator : zq2599
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
Utils.printTrack("selectImports : " + this.getClreplaced().getSimpleName());
return new String[] { "com.bolingcavalry.customizeimport.service.impl.CustomizeServiceImpl2" };
}
19
View Source File : CustomizeDeferredImportSelector.java
License : Apache License 2.0
Project Creator : zq2599
License : Apache License 2.0
Project Creator : zq2599
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
Utils.printTrack("selectImports : " + this.getClreplaced().getSimpleName());
return new String[] { "com.bolingcavalry.customizeimport.service.impl.CustomizeServiceImpl3" };
}
19
View Source File : CustomizeImportBeanDefinitionRegistrar.java
License : Apache License 2.0
Project Creator : zq2599
License : Apache License 2.0
Project Creator : zq2599
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClreplacedMetadata, BeanDefinitionRegistry registry) {
if (!registry.containsBeanDefinition(BEAN_NAME)) {
Utils.printTrack("start registerBeanDefinitions");
GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
beanDefinition.setBeanClreplaced(CustomizeServiceImpl4.clreplaced);
beanDefinition.setSynthetic(true);
registry.registerBeanDefinition(BEAN_NAME, beanDefinition);
}
}
19
View Source File : EnableConfigServiceImportSelector.java
License : Apache License 2.0
Project Creator : zouzhirong
License : Apache License 2.0
Project Creator : zouzhirong
@Override
public String[] selectImports(AnnotationMetadata metadata) {
return new String[] { ConfigImportBeanDefinitionRegistrar.clreplaced.getName(), ConfigConverterBeanRegistrar.clreplaced.getName() };
}
19
View Source File : FlowerComponentScanRegistrar.java
License : Apache License 2.0
Project Creator : zhihuili
License : Apache License 2.0
Project Creator : zhihuili
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClreplacedMetadata, BeanDefinitionRegistry registry) {
Set<String> packagesToScan = getPackagesToScan(importingClreplacedMetadata);
registerReferenceAnnotationBeanPostProcessor(registry, packagesToScan);
}
19
View Source File : NosqlConfiguration.java
License : MIT License
Project Creator : zhang-rf
License : MIT License
Project Creator : zhang-rf
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClreplacedMetadata, BeanDefinitionRegistry registry) {
// Noop
}
19
View Source File : ImportAutoConfigurationImportSelector.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Override
protected List<String> getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) {
List<String> candidates = new ArrayList<>();
Map<Clreplaced<?>, List<Annotation>> annotations = getAnnotations(metadata);
annotations.forEach((source, sourceAnnotations) -> collectCandidateConfigurations(source, sourceAnnotations, candidates));
return candidates;
}
19
View Source File : ImportAutoConfigurationImportSelector.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Override
protected AnnotationAttributes getAttributes(AnnotationMetadata metadata) {
return null;
}
19
View Source File : ImportAutoConfigurationImportSelector.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
protected final Map<Clreplaced<?>, List<Annotation>> getAnnotations(AnnotationMetadata metadata) {
MultiValueMap<Clreplaced<?>, Annotation> annotations = new LinkedMultiValueMap<>();
Clreplaced<?> source = ClreplacedUtils.resolveClreplacedName(metadata.getClreplacedName(), null);
collectAnnotations(source, annotations, new HashSet<>());
return Collections.unmodifiableMap(annotations);
}
19
View Source File : ImportAutoConfigurationImportSelector.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Override
public Set<Object> determineImports(AnnotationMetadata metadata) {
Set<String> result = new LinkedHashSet<>();
result.addAll(getCandidateConfigurations(metadata, null));
result.removeAll(getExclusions(metadata, null));
return Collections.unmodifiableSet(result);
}
19
View Source File : AbstractRepositoryConfigurationSourceSupport.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClreplacedMetadata, BeanDefinitionRegistry registry) {
new RepositoryConfigurationDelegate(getConfigurationSource(registry), this.resourceLoader, this.environment).registerRepositoriesIn(registry, getRepositoryConfigurationExtension());
}
19
View Source File : AutoConfigurationImportSelector.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
protected boolean isEnabled(AnnotationMetadata metadata) {
if (getClreplaced() == AutoConfigurationImportSelector.clreplaced) {
// 获取是否有配置spring.boot.enableautoconfiguration属性,默认返回true
return getEnvironment().getProperty(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY, Boolean.clreplaced, true);
}
return true;
}
19
View Source File : AutoConfigurationImportSelector.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
/**
* Return the {@link AutoConfigurationEntry} based on the {@link AnnotationMetadata}
* of the importing {@link Configuration @Configuration} clreplaced.
* @param autoConfigurationMetadata the auto-configuration metadata
* @param annotationMetadata the annotation metadata of the configuration clreplaced
* @return the auto-configurations that should be imported
*/
// 获取符合条件的自动配置类,避免加载不必要的自动配置类从而造成内存浪费
protected AutoConfigurationEntry getAutoConfigurationEntry(AutoConfigurationMetadata autoConfigurationMetadata, AnnotationMetadata annotationMetadata) {
// 获取是否有配置spring.boot.enableautoconfiguration属性,默认返回true
if (!isEnabled(annotationMetadata)) {
return EMPTY_ENTRY;
}
// 获得@Congiguration标注的Configuration类即被审视introspectedClreplaced的注解数据,
// 比如:@SpringBootApplication(exclude = FreeMarkerAutoConfiguration.clreplaced)
// 将会获取到exclude = FreeMarkerAutoConfiguration.clreplaced和excludeName=""的注解数据
AnnotationAttributes attributes = getAttributes(annotationMetadata);
// 【1】得到spring.factories文件配置的所有自动配置类
List<String> configurations = getCandidateConfigurations(annotationMetadata, attributes);
// 利用LinkedHashSet移除重复的配置类
configurations = removeDuplicates(configurations);
// 得到要排除的自动配置类,比如注解属性exclude的配置类
// 比如:@SpringBootApplication(exclude = FreeMarkerAutoConfiguration.clreplaced)
// 将会获取到exclude = FreeMarkerAutoConfiguration.clreplaced的注解数据
Set<String> exclusions = getExclusions(annotationMetadata, attributes);
// 检查要被排除的配置类,因为有些不是自动配置类,故要抛出异常
checkExcludedClreplacedes(configurations, exclusions);
// 【2】将要排除的配置类移除
configurations.removeAll(exclusions);
// 【3】因为从spring.factories文件获取的自动配置类太多,如果有些不必要的自动配置类都加载进内存,会造成内存浪费,因此这里需要进行过滤
// 注意这里会调用AutoConfigurationImportFilter的match方法来判断是否符合@ConditionalOnBean,@ConditionalOnClreplaced或@ConditionalOnWebApplication,后面会重点分析一下
configurations = filter(configurations, autoConfigurationMetadata);
// 【4】获取了符合条件的自动配置类后,此时触发AutoConfigurationImportEvent事件,
// 目的是告诉ConditionEvaluationReport条件评估报告器对象来记录符合条件的自动配置类
// 该事件什么时候会被触发?--> 在刷新容器时调用invokeBeanFactoryPostProcessors后置处理器时触发
fireAutoConfigurationImportEvents(configurations, exclusions);
// 【5】将符合条件和要排除的自动配置类封装进AutoConfigurationEntry对象,并返回
return new AutoConfigurationEntry(configurations, exclusions);
}
19
View Source File : EnableConfigurationPropertiesImportSelector.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Override
public String[] selectImports(AnnotationMetadata metadata) {
// 返回ConfigurationPropertiesBeanRegistrar和ConfigurationPropertiesBindingPostProcessorRegistrar的全限定名
// 即上面两个类将会被注册到Spring容器中
return IMPORTS;
}
19
View Source File : ConfigurationPropertiesBindingPostProcessorRegistrar.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClreplacedMetadata, BeanDefinitionRegistry registry) {
// 若容器中没有注册ConfigurationPropertiesBindingPostProcessor这个处理属性绑定的后置处理器,
// 那么将注册ConfigurationPropertiesBindingPostProcessor和ConfigurationBeanFactoryMetadata这两个bean
// 注意onApplicationEnvironmentPreparedEvent事件加载配置属性在先,然后再注册一些后置处理器用来处理这些配置属性
if (!registry.containsBeanDefinition(ConfigurationPropertiesBindingPostProcessor.BEAN_NAME)) {
// (1)注册ConfigurationPropertiesBindingPostProcessor后置处理器,用来对配置属性进行后置处理
registerConfigurationPropertiesBindingPostProcessor(registry);
// (2)注册一个ConfigurationBeanFactoryMetadata类型的bean,
// 注意ConfigurationBeanFactoryMetadata实现了BeanFactoryPostProcessor,然后其会在postProcessBeanFactory中注册一些元数据
registerConfigurationBeanFactoryMetadata(registry);
}
}
19
View Source File : EasyMapperRegistrar.java
License : MIT License
Project Creator : ymm-tech
License : MIT License
Project Creator : ymm-tech
private String[] getPackagesToScan(AnnotationAttributes attributes, AnnotationMetadata metadata) {
Set<String> packages = Stream.of(attributes.getStringArray("basePackages")).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
if (packages.isEmpty()) {
return new String[] { metadata.getClreplacedName().substring(0, metadata.getClreplacedName().lastIndexOf('.')) };
} else {
return packages.toArray(new String[0]);
}
}
19
View Source File : FilterImportSelector.java
License : MIT License
Project Creator : yizzuide
License : MIT License
Project Creator : yizzuide
@Override
public String[] selectImports(AnnotationMetadata importingClreplacedMetadata) {
boolean tomcatPresent = ClreplacedUtils.isPresent("org.apache.catalina.core.StandardContext", getClreplaced().getClreplacedLoader());
return tomcatPresent ? new String[] { "com.github.yizzuide.milkomeda.hydrogen.filter.TomcatFilterConfig" } : new String[] {};
}
19
View Source File : ConfigurationPropertiesImport.java
License : Apache License 2.0
Project Creator : yfh0918
License : Apache License 2.0
Project Creator : yfh0918
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClreplacedMetadata, BeanDefinitionRegistry registry) {
String beanName = ConfigurationProperties.BEAN_NAME;
if (!registry.containsBeanDefinition(beanName)) {
GenericBeanDefinition definition = new GenericBeanDefinition();
definition.setBeanClreplaced(ConfigurationProperties.clreplaced);
definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
registry.registerBeanDefinition(beanName, definition);
}
Clreplaced<?> clazz = null;
try {
clazz = Clreplaced.forName(importingClreplacedMetadata.getClreplacedName());
} catch (ClreplacedNotFoundException e) {
throw new ConfigException(importingClreplacedMetadata.getClreplacedName() + " is not found");
}
PolarisConfigurationProperties annotation = AnnotatedElementUtils.findMergedAnnotation(clazz, PolarisConfigurationProperties.clreplaced);
if (annotation != null) {
loadPropertiesFromAnnotation(annotation);
}
PolarisMultiConfigurationProperties annotations = AnnotatedElementUtils.findMergedAnnotation(clazz, PolarisMultiConfigurationProperties.clreplaced);
if (annotations != null && annotations.value() != null && annotations.value().length > 0) {
for (PolarisConfigurationProperties annotationElement : annotations.value()) {
loadPropertiesFromAnnotation(annotationElement);
}
}
}
19
View Source File : SwaggerSelector.java
License : Apache License 2.0
Project Creator : yanghaiji
License : Apache License 2.0
Project Creator : yanghaiji
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
return new String[] { "com.javayh.swagger.conf.SwaggerConfig" };
}
19
View Source File : MailImportSelector.java
License : Apache License 2.0
Project Creator : yanghaiji
License : Apache License 2.0
Project Creator : yanghaiji
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
return new String[] { "com.javayh.mail.server.MailSend" };
}
19
View Source File : LogImportSelector.java
License : Apache License 2.0
Project Creator : yanghaiji
License : Apache License 2.0
Project Creator : yanghaiji
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
return new String[] { "com.javayh.log.aop.SysLogAop", "com.javayh.log.conf.LogAutoConfig", "com.javayh.log.log.LogError" };
}
19
View Source File : HeartImportSelector.java
License : Apache License 2.0
Project Creator : yanghaiji
License : Apache License 2.0
Project Creator : yanghaiji
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
return new String[] { "com.javayh.client.config.HeartBeatConfig", "com.javayh.client.heart.HeartbeatClient", "com.javayh.client.properties.HeartbeatClientProperties" };
}
19
View Source File : SpringSelector.java
License : Apache License 2.0
Project Creator : yanghaiji
License : Apache License 2.0
Project Creator : yanghaiji
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
return new String[] { "com.javayh.common.util.spring.SpringUtils", "com.javayh.common.config.MyCommandLineRunner", "com.javayh.common.feign.GlobalFeignConfig", "com.javayh.common.feign.FeignClientOkHttpConfiguration", "com.javayh.common.feign.FeignExceptionConfig" };
}
19
View Source File : SpringI18nSelector.java
License : Apache License 2.0
Project Creator : yanghaiji
License : Apache License 2.0
Project Creator : yanghaiji
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
return new String[] { "com.javayh.common.i18n.config.InternationalConfig", "com.javayh.common.i18n.I18nResponseBodyAdvice" };
}
19
View Source File : ExceptionSelector.java
License : Apache License 2.0
Project Creator : yanghaiji
License : Apache License 2.0
Project Creator : yanghaiji
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
return new String[] { "com.javayh.common.exception.GlobalExceptionHandler" };
}
19
View Source File : MiraiPlusApplicationBeanContextRegistrar.java
License : GNU Affero General Public License v3.0
Project Creator : xiaoxu97
License : GNU Affero General Public License v3.0
Project Creator : xiaoxu97
@Override
public String[] selectImports(AnnotationMetadata annotationMetadata) {
return new String[] { MiraiPlusApplicationBeanContext.clreplaced.getName() };
}
19
View Source File : MyImportSelector.java
License : MIT License
Project Creator : wuyouzhuguli
License : MIT License
Project Creator : wuyouzhuguli
@Override
public String[] selectImports(AnnotationMetadata importingClreplacedMetadata) {
return new String[] { "cc.mrbird.demo.domain.Apple", "cc.mrbird.demo.domain.Banana", "cc.mrbird.demo.domain.Watermelon" };
}
19
View Source File : HelloWorldImportSelector.java
License : MIT License
Project Creator : wuyouzhuguli
License : MIT License
Project Creator : wuyouzhuguli
@Override
public String[] selectImports(AnnotationMetadata importingClreplacedMetadata) {
return new String[] { HelloWorldConfiguration.clreplaced.getName() };
}
19
View Source File : AbstractCommandScannerRegistrar.java
License : Apache License 2.0
Project Creator : wangmingco
License : Apache License 2.0
Project Creator : wangmingco
@Override
public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry beanDefinitionRegistry) {
log.debug("registerBeanDefinitions start: {}", annotationMetadata.getClreplacedName());
String[] scanPackages = getScanPackages(annotationMetadata);
// 自定义的包扫描器
AbstractClreplacedPathScanner commandClreplacedPathScanner = new AbstractClreplacedPathScanner(beanDefinitionRegistry, false);
if (resourceLoader != null) {
commandClreplacedPathScanner.setResourceLoader(resourceLoader);
}
// 这里实现的是根据名称来注入
commandClreplacedPathScanner.setBeanNameGenerator(new CommandNameGenerator());
// 扫描指定路径下的接口
Set<BeanDefinitionHolder> beanDefinitionHolders = commandClreplacedPathScanner.doScan(scanPackages);
try {
process(beanDefinitionRegistry, beanDefinitionHolders);
} catch (final Exception e) {
throw new RegisterException(e);
}
}
19
View Source File : AbstractTransactionManagementConfiguration.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableTx = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(EnableTransactionManagement.clreplaced.getName(), false));
if (this.enableTx == null) {
throw new IllegalArgumentException("@EnableTransactionManagement is not present on importing clreplaced " + importMetadata.getClreplacedName());
}
}
19
View Source File : SimpleMetadataReader.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* {@link MetadataReader} implementation based on an ASM
* {@link org.springframework.asm.ClreplacedReader}.
*
* @author Juergen Hoeller
* @author Costin Leau
* @since 2.5
*/
final clreplaced SimpleMetadataReader implements MetadataReader {
private static final int PARSING_OPTIONS = ClreplacedReader.SKIP_DEBUG | ClreplacedReader.SKIP_CODE | ClreplacedReader.SKIP_FRAMES;
private final Resource resource;
private final AnnotationMetadata annotationMetadata;
SimpleMetadataReader(Resource resource, @Nullable ClreplacedLoader clreplacedLoader) throws IOException {
SimpleAnnotationMetadataReadingVisitor visitor = new SimpleAnnotationMetadataReadingVisitor(clreplacedLoader);
getClreplacedReader(resource).accept(visitor, PARSING_OPTIONS);
this.resource = resource;
this.annotationMetadata = visitor.getMetadata();
}
private static ClreplacedReader getClreplacedReader(Resource resource) throws IOException {
try (InputStream is = new BufferedInputStream(resource.getInputStream())) {
try {
return new ClreplacedReader(is);
} catch (IllegalArgumentException ex) {
throw new NestedIOException("ASM ClreplacedReader failed to parse clreplaced file - " + "probably due to a new Java clreplaced file version that isn't supported yet: " + resource, ex);
}
}
}
@Override
public Resource getResource() {
return this.resource;
}
@Override
public ClreplacedMetadata getClreplacedMetadata() {
return this.annotationMetadata;
}
@Override
public AnnotationMetadata getAnnotationMetadata() {
return this.annotationMetadata;
}
}
19
View Source File : AbstractAsyncConfiguration.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableAsync = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(EnableAsync.clreplaced.getName(), false));
if (this.enableAsync == null) {
throw new IllegalArgumentException("@EnableAsync is not present on importing clreplaced " + importMetadata.getClreplacedName());
}
}
19
View Source File : ScannedGenericBeanDefinition.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Extension of the {@link org.springframework.beans.factory.support.GenericBeanDefinition}
* clreplaced, based on an ASM ClreplacedReader, with support for annotation metadata exposed
* through the {@link AnnotatedBeanDefinition} interface.
*
* <p>This clreplaced does <i>not</i> load the bean {@code Clreplaced} early.
* It rather retrieves all relevant metadata from the ".clreplaced" file itself,
* parsed with the ASM ClreplacedReader. It is functionally equivalent to
* {@link AnnotatedGenericBeanDefinition#AnnotatedGenericBeanDefinition(AnnotationMetadata)}
* but distinguishes by type beans that have been <em>scanned</em> vs those that have
* been otherwise registered or detected by other means.
*
* @author Juergen Hoeller
* @author Chris Beams
* @since 2.5
* @see #getMetadata()
* @see #getBeanClreplacedName()
* @see org.springframework.core.type.clreplacedreading.MetadataReaderFactory
* @see AnnotatedGenericBeanDefinition
*/
@SuppressWarnings("serial")
public clreplaced ScannedGenericBeanDefinition extends GenericBeanDefinition implements AnnotatedBeanDefinition {
private final AnnotationMetadata metadata;
/**
* Create a new ScannedGenericBeanDefinition for the clreplaced that the
* given MetadataReader describes.
* @param metadataReader the MetadataReader for the scanned target clreplaced
*/
public ScannedGenericBeanDefinition(MetadataReader metadataReader) {
replacedert.notNull(metadataReader, "MetadataReader must not be null");
this.metadata = metadataReader.getAnnotationMetadata();
setBeanClreplacedName(this.metadata.getClreplacedName());
}
@Override
public final AnnotationMetadata getMetadata() {
return this.metadata;
}
@Override
@Nullable
public MethodMetadata getFactoryMethodMetadata() {
return null;
}
}
19
View Source File : LoadTimeWeavingConfiguration.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableLTW = AnnotationConfigUtils.attributesFor(importMetadata, EnableLoadTimeWeaving.clreplaced);
if (this.enableLTW == null) {
throw new IllegalArgumentException("@EnableLoadTimeWeaving is not present on importing clreplaced " + importMetadata.getClreplacedName());
}
}
19
View Source File : ConfigurationClassUtils.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Check the given metadata for a configuration clreplaced candidate
* (or nested component clreplaced declared within a configuration/component clreplaced).
* @param metadata the metadata of the annotated clreplaced
* @return {@code true} if the given clreplaced is to be registered for
* configuration clreplaced processing; {@code false} otherwise
*/
public static boolean isConfigurationCandidate(AnnotationMetadata metadata) {
// Do not consider an interface or an annotation...
if (metadata.isInterface()) {
return false;
}
// Any of the typical annotations found?
for (String indicator : candidateIndicators) {
if (metadata.isAnnotated(indicator)) {
return true;
}
}
// Finally, let's look for @Bean methods...
try {
return metadata.hasAnnotatedMethods(Bean.clreplaced.getName());
} catch (Throwable ex) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to introspect @Bean methods on clreplaced [" + metadata.getClreplacedName() + "]: " + ex);
}
return false;
}
}
19
View Source File : ConfigurationClassParser.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
private boolean isChainedImportOnStack(ConfigurationClreplaced configClreplaced) {
if (this.importStack.contains(configClreplaced)) {
String configClreplacedName = configClreplaced.getMetadata().getClreplacedName();
AnnotationMetadata importingClreplaced = this.importStack.getImportingClreplacedFor(configClreplacedName);
while (importingClreplaced != null) {
if (configClreplacedName.equals(importingClreplaced.getClreplacedName())) {
return true;
}
importingClreplaced = this.importStack.getImportingClreplacedFor(importingClreplaced.getClreplacedName());
}
}
return false;
}
19
View Source File : ConfigurationClassParser.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
protected final void parse(AnnotationMetadata metadata, String beanName) throws IOException {
processConfigurationClreplaced(new ConfigurationClreplaced(metadata, beanName));
}
19
View Source File : ConfigurationClassParser.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Factory method to obtain a {@link SourceClreplaced} from a {@link ConfigurationClreplaced}.
*/
private SourceClreplaced replacedourceClreplaced(ConfigurationClreplaced configurationClreplaced) throws IOException {
AnnotationMetadata metadata = configurationClreplaced.getMetadata();
if (metadata instanceof StandardAnnotationMetadata) {
return replacedourceClreplaced(((StandardAnnotationMetadata) metadata).getIntrospectedClreplaced());
}
return replacedourceClreplaced(metadata.getClreplacedName());
}
19
View Source File : ConfigurationClass.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
public void addImportBeanDefinitionRegistrar(ImportBeanDefinitionRegistrar registrar, AnnotationMetadata importingClreplacedMetadata) {
this.importBeanDefinitionRegistrars.put(registrar, importingClreplacedMetadata);
}
19
View Source File : AnnotationConfigUtils.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata, Clreplaced<?> containerClreplaced, Clreplaced<?> annotationClreplaced) {
return attributesForRepeatable(metadata, containerClreplaced.getName(), annotationClreplaced.getName());
}
19
View Source File : AbstractCachingConfiguration.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableCaching = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(EnableCaching.clreplaced.getName(), false));
if (this.enableCaching == null) {
throw new IllegalArgumentException("@EnableCaching is not present on importing clreplaced " + importMetadata.getClreplacedName());
}
}
19
View Source File : RSocketClientsRegistrar.java
License : Apache License 2.0
Project Creator : spring-projects-experimental
License : Apache License 2.0
Project Creator : spring-projects-experimental
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClreplacedMetadata, BeanDefinitionRegistry registry) {
}
19
View Source File : Target_CacheConfigurationImportSelector.java
License : Apache License 2.0
Project Creator : spring-projects-experimental
License : Apache License 2.0
Project Creator : spring-projects-experimental
// TODO Import dynamically the required caching configuration as described in https://github.com/spring-projects-experimental/spring-native/issues/465
@Subsreplacedute
public String[] selectImports(AnnotationMetadata importingClreplacedMetadata) {
return new String[0];
}
19
View Source File : SampleRegistrar.java
License : Apache License 2.0
Project Creator : spring-projects-experimental
License : Apache License 2.0
Project Creator : spring-projects-experimental
@Override
public String[] selectImports(AnnotationMetadata importingClreplacedMetadata) {
return new String[] { BarPostProcessor.clreplaced.getName() };
}
19
View Source File : MyImportSelector.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
@Override
public String[] selectImports(AnnotationMetadata importingClreplacedMetadata) {
System.out.println("in MyImportSelector");
return new String[0];
}
19
View Source File : MyDeferredImportSelector.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
@Override
public String[] selectImports(AnnotationMetadata importingClreplacedMetadata) {
System.out.println("in MyDeferredImportSelector");
return new String[0];
}
19
View Source File : ScannedGenericBeanDefinition.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
/**
* Extension of the {@link org.springframework.beans.factory.support.GenericBeanDefinition}
* clreplaced, based on an ASM ClreplacedReader, with support for annotation metadata exposed
* through the {@link AnnotatedBeanDefinition} interface.
*
* <p>This clreplaced does <i>not</i> load the bean {@code Clreplaced} early.
* It rather retrieves all relevant metadata from the ".clreplaced" file itself,
* parsed with the ASM ClreplacedReader. It is functionally equivalent to
* {@link AnnotatedGenericBeanDefinition#AnnotatedGenericBeanDefinition(AnnotationMetadata)}
* but distinguishes by type beans that have been <em>scanned</em> vs those that have
* been otherwise registered or detected by other means.
*
* @author Juergen Hoeller
* @author Chris Beams
* @since 2.5
* @see #getMetadata()
* @see #getBeanClreplacedName()
* @see org.springframework.core.type.clreplacedreading.MetadataReaderFactory
* @see AnnotatedGenericBeanDefinition
*/
@SuppressWarnings("serial")
public clreplaced ScannedGenericBeanDefinition extends GenericBeanDefinition implements AnnotatedBeanDefinition {
/**
* 注解元信息
*/
private final AnnotationMetadata metadata;
/**
* Create a new ScannedGenericBeanDefinition for the clreplaced that the
* given MetadataReader describes.
* @param metadataReader the MetadataReader for the scanned target clreplaced
*/
public ScannedGenericBeanDefinition(MetadataReader metadataReader) {
replacedert.notNull(metadataReader, "MetadataReader must not be null");
// 获取注解元信息
this.metadata = metadataReader.getAnnotationMetadata();
setBeanClreplacedName(this.metadata.getClreplacedName());
}
@Override
public final AnnotationMetadata getMetadata() {
return this.metadata;
}
@Override
@Nullable
public MethodMetadata getFactoryMethodMetadata() {
return null;
}
}
See More Examples