本文整理汇总了Java中org.springframework.core.type.StandardAnnotationMetadata类的典型用法代码示例。如果您正苦于以下问题:Java StandardAnnotationMetadata类的具体用法?Java StandardAnnotationMetadata怎么用?Java StandardAnnotationMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StandardAnnotationMetadata类属于org.springframework.core.type包,在下文中一共展示了StandardAnnotationMetadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfigurationSource
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
private AnnotationRepositoryConfigurationSource getConfigurationSource(
BeanDefinitionRegistry registry) {
StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(
getConfiguration(), true);
return new MybatisAnnotationRepositoryConfigurationSource(metadata, getAnnotation(),
resourceLoader, this.environment, registry) {
@Override
public String[] getMapperLocations() {
return MybatisRepositoriesAutoConfigureRegistrar.this.getMapperLocations();
}
@Override
public Iterable<String> getBasePackages() {
return MybatisRepositoriesAutoConfigureRegistrar.this.getBasePackages();
}
};
}
开发者ID:hatunet,项目名称:spring-boot-starter-data-mybatis,代码行数:18,代码来源:MybatisRepositoriesAutoConfigureRegistrar.java
示例2: testViewScopedClass
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
@Test
public void testViewScopedClass() {
GenericApplicationContext acx = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(acx);
acx.registerBeanDefinition("viewScopedClass", new AnnotatedGenericBeanDefinition(
new StandardAnnotationMetadata(ViewScopedClass.class)));
acx.registerBeanDefinition("scopedBeansConfiguration", new RootBeanDefinition(
ScopedBeansConfiguration.class));
acx.addBeanFactoryPostProcessor(JsfScopeAnnotationsAutoConfiguration.jsfScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.addBeanFactoryPostProcessor(CdiScopeAnnotationsAutoConfiguration.cdiScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.refresh();
assertThat(acx.getBeanDefinition("viewScopedClass").getScope())
.isEqualTo(ViewScope.SCOPE_VIEW);
assertThat(acx.getBeanDefinition("viewScopedBean").getScope())
.isEqualTo(ViewScope.SCOPE_VIEW);
}
开发者ID:joinfaces,项目名称:joinfaces,代码行数:19,代码来源:JsfCdiToSpringApplicationBeanFactoryPostProcessorIT.java
示例3: testSessionScopedClass
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
@Test
public void testSessionScopedClass() {
GenericApplicationContext acx = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(acx);
acx.registerBeanDefinition("sessionScopedClass", new AnnotatedGenericBeanDefinition(
new StandardAnnotationMetadata(SessionScopedClass.class)));
acx.registerBeanDefinition("scopedBeansConfiguration", new RootBeanDefinition(
ScopedBeansConfiguration.class));
acx.addBeanFactoryPostProcessor(JsfScopeAnnotationsAutoConfiguration.jsfScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.addBeanFactoryPostProcessor(CdiScopeAnnotationsAutoConfiguration.cdiScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.refresh();
assertThat(acx.getBeanDefinition("sessionScopedClass").getScope())
.isEqualTo(WebApplicationContext.SCOPE_SESSION);
assertThat(acx.getBeanDefinition("sessionScopedBean").getScope())
.isEqualTo(WebApplicationContext.SCOPE_SESSION);
}
开发者ID:joinfaces,项目名称:joinfaces,代码行数:19,代码来源:JsfCdiToSpringApplicationBeanFactoryPostProcessorIT.java
示例4: testNoScopedClass
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
@Test
public void testNoScopedClass() {
GenericApplicationContext acx = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(acx);
acx.registerBeanDefinition("noScopedClass", new AnnotatedGenericBeanDefinition(
new StandardAnnotationMetadata(NoScopedClass.class)));
acx.registerBeanDefinition("scopedBeansConfiguration", new RootBeanDefinition(
ScopedBeansConfiguration.class));
acx.addBeanFactoryPostProcessor(JsfScopeAnnotationsAutoConfiguration.jsfScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.addBeanFactoryPostProcessor(CdiScopeAnnotationsAutoConfiguration.cdiScopeAnnotationsConfigurer(acx.getEnvironment()));
acx.refresh();
assertThat(acx.getBeanDefinition("noScopedClass").getScope())
.isEqualTo("");
assertThat(acx.getBeanDefinition("noScopedBean").getScope())
.isEqualTo("");
}
开发者ID:joinfaces,项目名称:joinfaces,代码行数:20,代码来源:JsfCdiToSpringApplicationBeanFactoryPostProcessorIT.java
示例5: processMemberClasses
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
/**
* Register member (nested) classes that happen to be configuration classes themselves.
* @param metadata the metadata representation of the containing class
* @throws IOException if there is any problem reading metadata from a member class
*/
private void processMemberClasses(AnnotationMetadata metadata) throws IOException {
if (metadata instanceof StandardAnnotationMetadata) {
for (Class<?> memberClass : ((StandardAnnotationMetadata) metadata).getIntrospectedClass().getDeclaredClasses()) {
if (ConfigurationClassUtils.isConfigurationCandidate(new StandardAnnotationMetadata(memberClass))) {
processConfigurationClass(new ConfigurationClass(memberClass, true));
}
}
}
else {
for (String memberClassName : metadata.getMemberClassNames()) {
MetadataReader reader = this.metadataReaderFactory.getMetadataReader(memberClassName);
AnnotationMetadata memberClassMetadata = reader.getAnnotationMetadata();
if (ConfigurationClassUtils.isConfigurationCandidate(memberClassMetadata)) {
processConfigurationClass(new ConfigurationClass(reader, true));
}
}
}
}
示例6: matches
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
public static boolean matches(ConditionContext context) {
Class<AuthorizationServerEndpointsConfigurationBeanCondition> type = AuthorizationServerEndpointsConfigurationBeanCondition.class;
Conditional conditional = AnnotationUtils.findAnnotation(type,
Conditional.class);
StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(type);
for (Class<? extends Condition> conditionType : conditional.value()) {
Condition condition = BeanUtils.instantiateClass(conditionType);
if (condition.matches(context, metadata)) {
return true;
}
}
return false;
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:14,代码来源:OAuth2ResourceServerConfiguration.java
示例7: asSourceClass
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
/**
* Factory method to obtain a {@link SourceClass} from a {@link ConfigurationClass}.
*/
public SourceClass asSourceClass(ConfigurationClass configurationClass) throws IOException {
try {
AnnotationMetadata metadata = configurationClass.getMetadata();
if (metadata instanceof StandardAnnotationMetadata) {
return asSourceClass(((StandardAnnotationMetadata) metadata).getIntrospectedClass());
}
return asSourceClass(configurationClass.getMetadata().getClassName());
}
catch (ClassNotFoundException ex) {
throw new IllegalStateException(ex);
}
}
示例8: SourceClass
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
public SourceClass(Object source) {
this.source = source;
if (source instanceof Class<?>) {
this.metadata = new StandardAnnotationMetadata((Class<?>) source, true);
}
else {
this.metadata = ((MetadataReader) source).getAnnotationMetadata();
}
}
示例9: AnnotatedGenericBeanDefinition
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
/**
* Create a new AnnotatedGenericBeanDefinition for the given annotation metadata,
* allowing for ASM-based processing and avoidance of early loading of the bean class.
* Note that this constructor is functionally equivalent to
* {@link org.springframework.context.annotation.ScannedGenericBeanDefinition
* ScannedGenericBeanDefinition}, however the semantics of the latter indicate that a
* bean was discovered specifically via component-scanning as opposed to other means.
* @param metadata the annotation metadata for the bean class in question
* @since 3.1.1
*/
public AnnotatedGenericBeanDefinition(AnnotationMetadata metadata) {
Assert.notNull(metadata, "AnnotationMetadata must not be null");
if (metadata instanceof StandardAnnotationMetadata) {
setBeanClass(((StandardAnnotationMetadata) metadata).getIntrospectedClass());
}
else {
setBeanClassName(metadata.getClassName());
}
this.metadata = metadata;
}
示例10: asSourceClass
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
/**
* Factory method to obtain a {@link SourceClass} from a {@link ConfigurationClass}.
*/
public SourceClass asSourceClass(ConfigurationClass configurationClass) throws IOException {
AnnotationMetadata metadata = configurationClass.getMetadata();
if (metadata instanceof StandardAnnotationMetadata) {
return asSourceClass(((StandardAnnotationMetadata) metadata).getIntrospectedClass());
}
return asSourceClass(configurationClass.getMetadata().getClassName());
}
示例11: ConfigurationClass
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
/**
* Create a new {@link ConfigurationClass} with the given name.
* @param clazz the underlying {@link Class} to represent
* @param beanName name of the {@code @Configuration} class bean
* @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
*/
public ConfigurationClass(Class<?> clazz, String beanName) {
Assert.hasText(beanName, "Bean name must not be null");
this.metadata = new StandardAnnotationMetadata(clazz, true);
this.resource = new DescriptiveResource(clazz.toString());
this.beanName = beanName;
}
示例12: metadataFromImportsOneThenTwo
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
@Test
public void metadataFromImportsOneThenTwo() {
AnnotationMetadata importMetadata = new AnnotationConfigApplicationContext(
ConfigurationOne.class, ConfigurationTwo.class)
.getBean(MetadataHolder.class).importMetadata;
assertEquals(ConfigurationOne.class,
((StandardAnnotationMetadata) importMetadata).getIntrospectedClass());
}
示例13: metadataFromImportsTwoThenOne
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
@Test
public void metadataFromImportsTwoThenOne() {
AnnotationMetadata importMetadata = new AnnotationConfigApplicationContext(
ConfigurationTwo.class, ConfigurationOne.class)
.getBean(MetadataHolder.class).importMetadata;
assertEquals(ConfigurationOne.class,
((StandardAnnotationMetadata) importMetadata).getIntrospectedClass());
}
示例14: ConfigurationClass
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
/**
* Create a new {@link ConfigurationClass} with the given name.
* @param clazz the underlying {@link Class} to represent
* @param beanName name of the {@code @Configuration} class bean
* @throws IllegalArgumentException if beanName is null (as of Spring 3.1.1)
* @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
*/
public ConfigurationClass(Class<?> clazz, String beanName) {
Assert.hasText(beanName, "Bean name must not be null");
this.metadata = new StandardAnnotationMetadata(clazz, true);
this.resource = new DescriptiveResource(clazz.toString());
this.beanName = beanName;
this.importedBy = null;
}
示例15: getConfigurationSource
import org.springframework.core.type.StandardAnnotationMetadata; //导入依赖的package包/类
private AnnotationRepositoryConfigurationSource getConfigurationSource() {
StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(
getConfiguration(), true);
return new AnnotationRepositoryConfigurationSource(metadata, getAnnotation(),
this.resourceLoader, this.environment) {
@Override
public java.lang.Iterable<String> getBasePackages() {
return AbstractRepositoryConfigurationSourceSupport.this
.getBasePackages();
}
};
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:AbstractRepositoryConfigurationSourceSupport.java