本文整理汇总了Java中org.springframework.core.type.AnnotationMetadata.isAnnotated方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationMetadata.isAnnotated方法的具体用法?Java AnnotationMetadata.isAnnotated怎么用?Java AnnotationMetadata.isAnnotated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.type.AnnotationMetadata
的用法示例。
在下文中一共展示了AnnotationMetadata.isAnnotated方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerBeanDefinitions
import org.springframework.core.type.AnnotationMetadata; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry registry) {
// Single annotation
if (annotationMetadata.isAnnotated(repeatableAnnotation.getName())) {
register(annotationMetadata.getAnnotationAttributes(repeatableAnnotation.getName()), registry, false);
} else if (annotationMetadata.isAnnotated(repeatableAnnotationContainer.getName())) {
// Multiple annotations
Map<String, Object> attributes = annotationMetadata
.getAnnotationAttributes(repeatableAnnotationContainer.getName());
AnnotationAttributes[] repetitions = (AnnotationAttributes[]) attributes.get("value");
if (repetitions != null) {
for (AnnotationAttributes repetition : repetitions) {
register(repetition, registry, true);
}
}
}
}
示例2: registerBeanDefinitions
import org.springframework.core.type.AnnotationMetadata; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry registry) {
if (!annotationMetadata.isAnnotated(EnableJdbcDatastore.class.getName())) {
// ignore call from sub classes
return;
}
Map<String, Object> attributes = annotationMetadata
.getAnnotationAttributes(EnableJdbcDatastore.class.getName());
// attributes
String dataContextId = BeanRegistryUtils.getAnnotationValue(attributes, "dataContextId", null);
PrimaryMode primaryMode = BeanRegistryUtils.getAnnotationValue(attributes, "primary", PrimaryMode.AUTO);
String dataSourceReference = BeanRegistryUtils.getAnnotationValue(attributes, "dataSourceReference", null);
String dataSourceBeanName = dataSourceReference;
if (dataSourceBeanName == null) {
dataSourceBeanName = BeanRegistryUtils.buildBeanName(dataContextId,
EnableDataSource.DEFAULT_DATASOURCE_BEAN_NAME);
}
registerDatastore(registry, getEnvironment(), dataContextId, primaryMode, dataSourceBeanName,
BeanRegistryUtils.getAnnotationValue(attributes, "platform", DatabasePlatform.NONE),
BeanRegistryUtils.getAnnotationValue(attributes, "transactional", true), beanClassLoader);
}
示例3: registerBeanDefinitions
import org.springframework.core.type.AnnotationMetadata; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry registry) {
if (!annotationMetadata.isAnnotated(EnableDataSource.class.getName())) {
// ignore call from sub classes
return;
}
Map<String, Object> attributes = annotationMetadata.getAnnotationAttributes(EnableDataSource.class.getName());
// Annotation values
String dataContextId = BeanRegistryUtils.getAnnotationValue(attributes, "dataContextId", null);
PrimaryMode primaryMode = BeanRegistryUtils.getAnnotationValue(attributes, "primary", PrimaryMode.AUTO);
boolean registerTransactionManager = BeanRegistryUtils.getAnnotationValue(attributes,
"enableTransactionManager", false);
String dsBeanName = registerDataSource(getEnvironment(), registry, dataContextId, primaryMode);
// Transaction manager
if (registerTransactionManager) {
registerDataSourceTransactionManager(registry, dsBeanName, dataContextId, primaryMode);
}
}
示例4: registerBeanDefinitions
import org.springframework.core.type.AnnotationMetadata; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry registry) {
if (!annotationMetadata.isAnnotated(EnableJpa.class.getName())) {
// ignore call from sub classes
return;
}
Map<String, Object> attributes = annotationMetadata.getAnnotationAttributes(EnableJpa.class.getName());
registerJpaBeans(registry, beanFactory, getEnvironment(), attributes, beanClassLoader);
}
示例5: registerBeanDefinitions
import org.springframework.core.type.AnnotationMetadata; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry registry) {
if (!annotationMetadata.isAnnotated(EnableJpaDatastore.class.getName())) {
// ignore call from sub classes
return;
}
Map<String, Object> attributes = annotationMetadata.getAnnotationAttributes(EnableJpaDatastore.class.getName());
// attributes
String dataContextId = BeanRegistryUtils.getAnnotationValue(attributes, "dataContextId", null);
PrimaryMode primaryMode = BeanRegistryUtils.getAnnotationValue(attributes, "primary", PrimaryMode.AUTO);
String entityManagerFactoryReference = BeanRegistryUtils.getAnnotationValue(attributes,
"entityManagerFactoryReference", null);
String emfBeanName = entityManagerFactoryReference;
if (emfBeanName == null) {
emfBeanName = BeanRegistryUtils.buildBeanName(dataContextId,
EnableJpa.DEFAULT_ENTITYMANAGERFACTORY_BEAN_NAME);
}
registerDatastore(registry, dataContextId, primaryMode, emfBeanName,
BeanRegistryUtils.getAnnotationValue(attributes, "transactional", true),
BeanRegistryUtils.getAnnotationValue(attributes, "autoFlush", false), beanClassLoader);
}
示例6: isFullConfigurationCandidate
import org.springframework.core.type.AnnotationMetadata; //导入方法依赖的package包/类
/**
* Check the given metadata for a full configuration class candidate
* (i.e. a class annotated with {@code @Configuration}).
* @param metadata the metadata of the annotated class
* @return {@code true} if the given class is to be processed as a full
* configuration class, including cross-method call interception
*/
public static boolean isFullConfigurationCandidate(AnnotationMetadata metadata) {
return metadata.isAnnotated(Configuration.class.getName());
}
示例7: isLiteConfigurationCandidate
import org.springframework.core.type.AnnotationMetadata; //导入方法依赖的package包/类
/**
* Check the given metadata for a lite configuration class candidate
* (e.g. a class annotated with {@code @Component} or just having
* {@code @Import} declarations or {@code @Bean methods}).
* @param metadata the metadata of the annotated class
* @return {@code true} if the given class is to be processed as a lite
* configuration class, just registering it and scanning it for {@code @Bean} methods
*/
public static boolean isLiteConfigurationCandidate(AnnotationMetadata metadata) {
// Do not consider an interface or an annotation...
return (!metadata.isInterface() && (metadata.isAnnotated(Component.class.getName()) ||
metadata.isAnnotated(Import.class.getName()) || metadata.hasAnnotatedMethods(Bean.class.getName())));
}