Sync with 3.1.x
* 3.1.x: Demonstrate use of @Configuration as meta-annotation Prune dead code from JmsTransactionManager#doBegin Apply @Configuration BeanNameGenerator consistently Improve @Configuration bean name discovery Fix infinite recursion bug in nested @Configuration Polish static imports Minor fix in ServletResponseMethodArgumentResolver extracted ResourceUtils.useCachesIfNecessary(URLConnection) method (SP prepared for 3.1.1 release CustomSQLExceptionTranslatorRegistry/Registrar etc revised CustomSQLExceptionTranslatorRegistry/Registrar method naming use custom InputStream traversal instead of a full byte array (SPR-911 PathMatchingResourcePatternResolver preserves caching for JNLP jar con Resource "contentLength()" implementations work with OSGi bundle resou fixed MethodInvokingJobDetailFactoryBean for compatibility with Quartz fixed MethodInvokingJobDetailFactoryBean for compatibility with Quartz
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.beans.factory.annotation;
|
||||
import org.springframework.beans.factory.support.GenericBeanDefinition;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.core.type.StandardAnnotationMetadata;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Extension of the {@link org.springframework.beans.factory.support.GenericBeanDefinition}
|
||||
@@ -32,27 +33,46 @@ import org.springframework.core.type.StandardAnnotationMetadata;
|
||||
* which also implements the AnnotatedBeanDefinition interface).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @since 2.5
|
||||
* @see AnnotatedBeanDefinition#getMetadata()
|
||||
* @see org.springframework.core.type.StandardAnnotationMetadata
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class AnnotatedGenericBeanDefinition extends GenericBeanDefinition implements AnnotatedBeanDefinition {
|
||||
|
||||
private final AnnotationMetadata annotationMetadata;
|
||||
private final AnnotationMetadata metadata;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new AnnotatedGenericBeanDefinition for the given bean class.
|
||||
* @param beanClass the loaded bean class
|
||||
*/
|
||||
public AnnotatedGenericBeanDefinition(Class beanClass) {
|
||||
public AnnotatedGenericBeanDefinition(Class<?> beanClass) {
|
||||
setBeanClass(beanClass);
|
||||
this.annotationMetadata = new StandardAnnotationMetadata(beanClass, true);
|
||||
this.metadata = new StandardAnnotationMetadata(beanClass, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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");
|
||||
setBeanClassName(metadata.getClassName());
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
|
||||
public final AnnotationMetadata getMetadata() {
|
||||
return this.annotationMetadata;
|
||||
return this.metadata;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user