Add @Override annotations to main sources
Issue: SPR-10130
This commit is contained in:
@@ -36,31 +36,38 @@ public abstract class AbstractPropertyAccessor extends TypeConverterSupport impl
|
||||
private boolean extractOldValueForEditor = false;
|
||||
|
||||
|
||||
@Override
|
||||
public void setExtractOldValueForEditor(boolean extractOldValueForEditor) {
|
||||
this.extractOldValueForEditor = extractOldValueForEditor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExtractOldValueForEditor() {
|
||||
return this.extractOldValueForEditor;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPropertyValue(PropertyValue pv) throws BeansException {
|
||||
setPropertyValue(pv.getName(), pv.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyValues(Map<?, ?> map) throws BeansException {
|
||||
setPropertyValues(new MutablePropertyValues(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyValues(PropertyValues pvs) throws BeansException {
|
||||
setPropertyValues(pvs, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown) throws BeansException {
|
||||
setPropertyValues(pvs, ignoreUnknown, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid)
|
||||
throws BeansException {
|
||||
|
||||
@@ -118,6 +125,7 @@ public abstract class AbstractPropertyAccessor extends TypeConverterSupport impl
|
||||
* @throws PropertyAccessException if the property was valid but the
|
||||
* accessor method failed
|
||||
*/
|
||||
@Override
|
||||
public abstract Object getPropertyValue(String propertyName) throws BeansException;
|
||||
|
||||
/**
|
||||
@@ -129,6 +137,7 @@ public abstract class AbstractPropertyAccessor extends TypeConverterSupport impl
|
||||
* @throws PropertyAccessException if the property was valid but the
|
||||
* accessor method failed or a type mismatch occured
|
||||
*/
|
||||
@Override
|
||||
public abstract void setPropertyValue(String propertyName, Object value) throws BeansException;
|
||||
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ public class BeanMetadataAttribute implements BeanMetadataElement {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public class BeanMetadataAttributeAccessor extends AttributeAccessorSupport impl
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -219,10 +219,12 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
setIntrospectionClass(object.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object getWrappedInstance() {
|
||||
return this.object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Class getWrappedClass() {
|
||||
return (this.object != null ? this.object.getClass() : null);
|
||||
}
|
||||
@@ -257,6 +259,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
* enables auto-growth of collection elements when accessing an out-of-bounds index.
|
||||
* <p>Default is "false" on a plain BeanWrapper.
|
||||
*/
|
||||
@Override
|
||||
public void setAutoGrowNestedPaths(boolean autoGrowNestedPaths) {
|
||||
this.autoGrowNestedPaths = autoGrowNestedPaths;
|
||||
}
|
||||
@@ -264,6 +267,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
/**
|
||||
* Return whether "auto-growing" of nested paths has been activated.
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutoGrowNestedPaths() {
|
||||
return this.autoGrowNestedPaths;
|
||||
}
|
||||
@@ -272,6 +276,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
* Specify a limit for array and collection auto-growing.
|
||||
* <p>Default is unlimited on a plain BeanWrapper.
|
||||
*/
|
||||
@Override
|
||||
public void setAutoGrowCollectionLimit(int autoGrowCollectionLimit) {
|
||||
this.autoGrowCollectionLimit = autoGrowCollectionLimit;
|
||||
}
|
||||
@@ -279,6 +284,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
/**
|
||||
* Return the limit for array and collection auto-growing.
|
||||
*/
|
||||
@Override
|
||||
public int getAutoGrowCollectionLimit() {
|
||||
return this.autoGrowCollectionLimit;
|
||||
}
|
||||
@@ -324,10 +330,12 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor[] getPropertyDescriptors() {
|
||||
return getCachedIntrospectionResults().getPropertyDescriptors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor getPropertyDescriptor(String propertyName) throws BeansException {
|
||||
PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
|
||||
if (pd == null) {
|
||||
@@ -378,6 +386,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException {
|
||||
try {
|
||||
BeanWrapperImpl nestedBw = getBeanWrapperForPropertyPath(propertyName);
|
||||
@@ -402,6 +411,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadableProperty(String propertyName) {
|
||||
try {
|
||||
PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
|
||||
@@ -422,6 +432,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWritableProperty(String propertyName) {
|
||||
try {
|
||||
PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
|
||||
@@ -711,6 +722,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
if (!Modifier.isPublic(readMethod.getDeclaringClass().getModifiers()) && !readMethod.isAccessible()) {
|
||||
if (System.getSecurityManager() != null) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
readMethod.setAccessible(true);
|
||||
return null;
|
||||
@@ -726,6 +738,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
if (System.getSecurityManager() != null) {
|
||||
try {
|
||||
value = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
return readMethod.invoke(object, (Object[]) null);
|
||||
}
|
||||
@@ -1062,6 +1075,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
!readMethod.isAccessible()) {
|
||||
if (System.getSecurityManager()!= null) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
readMethod.setAccessible(true);
|
||||
return null;
|
||||
@@ -1075,6 +1089,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
try {
|
||||
if (System.getSecurityManager() != null) {
|
||||
oldValue = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
return readMethod.invoke(object);
|
||||
}
|
||||
@@ -1104,6 +1119,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
if (!Modifier.isPublic(writeMethod.getDeclaringClass().getModifiers()) && !writeMethod.isAccessible()) {
|
||||
if (System.getSecurityManager()!= null) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
writeMethod.setAccessible(true);
|
||||
return null;
|
||||
@@ -1118,6 +1134,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
if (System.getSecurityManager() != null) {
|
||||
try {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
writeMethod.invoke(object, value);
|
||||
return null;
|
||||
|
||||
@@ -59,6 +59,7 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
Assert.notNull(target, "Target object must not be null");
|
||||
this.target = target;
|
||||
ReflectionUtils.doWithFields(this.target.getClass(), new ReflectionUtils.FieldCallback() {
|
||||
@Override
|
||||
public void doWith(Field field) {
|
||||
if (fieldMap.containsKey(field.getName())) {
|
||||
// ignore superclass declarations of fields already found in a subclass
|
||||
@@ -74,10 +75,12 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isReadableProperty(String propertyName) throws BeansException {
|
||||
return this.fieldMap.containsKey(propertyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWritableProperty(String propertyName) throws BeansException {
|
||||
return this.fieldMap.containsKey(propertyName);
|
||||
}
|
||||
@@ -91,6 +94,7 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException {
|
||||
Field field = this.fieldMap.get(propertyName);
|
||||
if (field != null) {
|
||||
|
||||
@@ -217,35 +217,43 @@ class ExtendedBeanInfo implements BeanInfo {
|
||||
* method found during construction.
|
||||
* @see #ExtendedBeanInfo(BeanInfo)
|
||||
*/
|
||||
@Override
|
||||
public PropertyDescriptor[] getPropertyDescriptors() {
|
||||
return this.propertyDescriptors.toArray(
|
||||
new PropertyDescriptor[this.propertyDescriptors.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanInfo[] getAdditionalBeanInfo() {
|
||||
return delegate.getAdditionalBeanInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanDescriptor getBeanDescriptor() {
|
||||
return delegate.getBeanDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultEventIndex() {
|
||||
return delegate.getDefaultEventIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultPropertyIndex() {
|
||||
return delegate.getDefaultPropertyIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventSetDescriptor[] getEventSetDescriptors() {
|
||||
return delegate.getEventSetDescriptors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getIcon(int iconKind) {
|
||||
return delegate.getIcon(iconKind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodDescriptor[] getMethodDescriptors() {
|
||||
return delegate.getMethodDescriptors();
|
||||
}
|
||||
@@ -655,6 +663,7 @@ class PropertyDescriptorUtils {
|
||||
*/
|
||||
class PropertyDescriptorComparator implements Comparator<PropertyDescriptor> {
|
||||
|
||||
@Override
|
||||
public int compare(PropertyDescriptor desc1, PropertyDescriptor desc2) {
|
||||
String left = desc1.getName();
|
||||
String right = desc2.getName();
|
||||
|
||||
@@ -40,6 +40,7 @@ public class ExtendedBeanInfoFactory implements Ordered, BeanInfoFactory {
|
||||
/**
|
||||
* Return a new {@link ExtendedBeanInfo} for the given bean class.
|
||||
*/
|
||||
@Override
|
||||
public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {
|
||||
return supports(beanClass) ?
|
||||
new ExtendedBeanInfo(Introspector.getBeanInfo(beanClass)) : null;
|
||||
@@ -58,6 +59,7 @@ public class ExtendedBeanInfoFactory implements Ordered, BeanInfoFactory {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return Ordered.LOWEST_PRECEDENCE;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public class MethodInvocationException extends PropertyAccessException {
|
||||
super(propertyChangeEvent, "Property '" + propertyChangeEvent.getPropertyName() + "' threw exception", cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorCode() {
|
||||
return ERROR_CODE;
|
||||
}
|
||||
|
||||
@@ -244,10 +244,12 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PropertyValue[] getPropertyValues() {
|
||||
return this.propertyValueList.toArray(new PropertyValue[this.propertyValueList.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyValue getPropertyValue(String propertyName) {
|
||||
for (PropertyValue pv : this.propertyValueList) {
|
||||
if (pv.getName().equals(propertyName)) {
|
||||
@@ -257,6 +259,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyValues changesSince(PropertyValues old) {
|
||||
MutablePropertyValues changes = new MutablePropertyValues();
|
||||
if (old == this) {
|
||||
@@ -278,11 +281,13 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
return changes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String propertyName) {
|
||||
return (getPropertyValue(propertyName) != null ||
|
||||
(this.processedProperties != null && this.processedProperties.contains(propertyName)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.propertyValueList.isEmpty();
|
||||
}
|
||||
|
||||
@@ -269,10 +269,12 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
||||
// Management of custom editors
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor) {
|
||||
registerCustomEditor(requiredType, null, propertyEditor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCustomEditor(Class<?> requiredType, String propertyPath, PropertyEditor propertyEditor) {
|
||||
if (requiredType == null && propertyPath == null) {
|
||||
throw new IllegalArgumentException("Either requiredType or propertyPath is required");
|
||||
@@ -319,6 +321,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
||||
return (this.sharedEditors != null && this.sharedEditors.contains(propertyEditor));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyEditor findCustomEditor(Class<?> requiredType, String propertyPath) {
|
||||
Class<?> requiredTypeToUse = requiredType;
|
||||
if (propertyPath != null) {
|
||||
|
||||
@@ -35,16 +35,19 @@ public abstract class TypeConverterSupport extends PropertyEditorRegistrySupport
|
||||
TypeConverterDelegate typeConverterDelegate;
|
||||
|
||||
|
||||
@Override
|
||||
public <T> T convertIfNecessary(Object value, Class<T> requiredType) throws TypeMismatchException {
|
||||
return doConvert(value, requiredType, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T convertIfNecessary(Object value, Class<T> requiredType, MethodParameter methodParam)
|
||||
throws TypeMismatchException {
|
||||
|
||||
return doConvert(value, requiredType, methodParam, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T convertIfNecessary(Object value, Class<T> requiredType, Field field)
|
||||
throws TypeMismatchException {
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ public class TypeMismatchException extends PropertyAccessException {
|
||||
return this.requiredType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorCode() {
|
||||
return ERROR_CODE;
|
||||
}
|
||||
|
||||
@@ -349,6 +349,7 @@ public class SingletonBeanFactoryLocator implements BeanFactoryLocator {
|
||||
this.resourceLocation = resourceLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanFactoryReference useBeanFactory(String factoryKey) throws BeansException {
|
||||
synchronized (this.bfgInstancesByKey) {
|
||||
BeanFactoryGroup bfg = this.bfgInstancesByKey.get(this.resourceLocation);
|
||||
@@ -500,11 +501,13 @@ public class SingletonBeanFactoryLocator implements BeanFactoryLocator {
|
||||
this.groupContextRef = groupContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanFactory getFactory() {
|
||||
return this.beanFactory;
|
||||
}
|
||||
|
||||
// Note that it's legal to call release more than once!
|
||||
@Override
|
||||
public void release() throws FatalBeanException {
|
||||
synchronized (bfgInstancesByKey) {
|
||||
BeanFactory savedRef = this.groupContextRef;
|
||||
|
||||
@@ -71,6 +71,7 @@ public class AnnotatedGenericBeanDefinition extends GenericBeanDefinition implem
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final AnnotationMetadata getMetadata() {
|
||||
return this.metadata;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.util.ClassUtils;
|
||||
*/
|
||||
public class AnnotationBeanWiringInfoResolver implements BeanWiringInfoResolver {
|
||||
|
||||
@Override
|
||||
public BeanWiringInfo resolveWiringInfo(Object beanInstance) {
|
||||
Assert.notNull(beanInstance, "Bean instance must not be null");
|
||||
Configurable annotation = beanInstance.getClass().getAnnotation(Configurable.class);
|
||||
|
||||
@@ -199,10 +199,12 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
if (!(beanFactory instanceof ConfigurableListableBeanFactory)) {
|
||||
throw new IllegalArgumentException(
|
||||
@@ -212,6 +214,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
|
||||
if (beanType != null) {
|
||||
InjectionMetadata metadata = findAutowiringMetadata(beanType);
|
||||
|
||||
@@ -59,10 +59,12 @@ public class CustomAutowireConfigurer implements BeanFactoryPostProcessor, BeanC
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
@@ -82,6 +84,7 @@ public class CustomAutowireConfigurer implements BeanFactoryPostProcessor, BeanC
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
if (this.customQualifierTypes != null) {
|
||||
|
||||
@@ -112,11 +112,13 @@ public class InitDestroyAnnotationBeanPostProcessor
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
|
||||
if (beanType != null) {
|
||||
LifecycleMetadata metadata = findLifecycleMetadata(beanType);
|
||||
@@ -124,6 +126,7 @@ public class InitDestroyAnnotationBeanPostProcessor
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
LifecycleMetadata metadata = findLifecycleMetadata(bean.getClass());
|
||||
try {
|
||||
@@ -138,10 +141,12 @@ public class InitDestroyAnnotationBeanPostProcessor
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
|
||||
LifecycleMetadata metadata = findLifecycleMetadata(bean.getClass());
|
||||
try {
|
||||
|
||||
@@ -126,6 +126,7 @@ public class QualifierAnnotationAutowireCandidateResolver implements AutowireCan
|
||||
this.valueAnnotationType = valueAnnotationType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
@@ -143,6 +144,7 @@ public class QualifierAnnotationAutowireCandidateResolver implements AutowireCan
|
||||
* attribute does not match.
|
||||
* @see Qualifier
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) {
|
||||
if (!bdHolder.getBeanDefinition().isAutowireCandidate()) {
|
||||
// if explicitly false, do not proceed with qualifier check
|
||||
@@ -293,6 +295,7 @@ public class QualifierAnnotationAutowireCandidateResolver implements AutowireCan
|
||||
* Determine whether the given dependency carries a value annotation.
|
||||
* @see Value
|
||||
*/
|
||||
@Override
|
||||
public Object getSuggestedValue(DependencyDescriptor descriptor) {
|
||||
Object value = findValue(descriptor.getAnnotations());
|
||||
if (value == null) {
|
||||
|
||||
@@ -116,6 +116,7 @@ public class RequiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP
|
||||
return this.requiredAnnotationType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
if (beanFactory instanceof ConfigurableListableBeanFactory) {
|
||||
this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
|
||||
@@ -126,11 +127,13 @@ public class RequiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
|
||||
}
|
||||
|
||||
|
||||
@@ -84,14 +84,17 @@ public abstract class AbstractFactoryBean<T>
|
||||
this.singleton = singleton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return this.singleton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
@@ -124,6 +127,7 @@ public abstract class AbstractFactoryBean<T>
|
||||
/**
|
||||
* Eagerly create the singleton instance, if necessary.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (isSingleton()) {
|
||||
this.initialized = true;
|
||||
@@ -138,6 +142,7 @@ public abstract class AbstractFactoryBean<T>
|
||||
* @see #createInstance()
|
||||
* @see #getEarlySingletonInterfaces()
|
||||
*/
|
||||
@Override
|
||||
public final T getObject() throws Exception {
|
||||
if (isSingleton()) {
|
||||
return (this.initialized ? this.singletonInstance : getEarlySingletonInstance());
|
||||
@@ -181,6 +186,7 @@ public abstract class AbstractFactoryBean<T>
|
||||
* Destroy the singleton instance, if any.
|
||||
* @see #destroyInstance(Object)
|
||||
*/
|
||||
@Override
|
||||
public void destroy() throws Exception {
|
||||
if (isSingleton()) {
|
||||
destroyInstance(this.singletonInstance);
|
||||
@@ -193,6 +199,7 @@ public abstract class AbstractFactoryBean<T>
|
||||
* interface, for a consistent offering of abstract template methods.
|
||||
* @see org.springframework.beans.factory.FactoryBean#getObjectType()
|
||||
*/
|
||||
@Override
|
||||
public abstract Class<?> getObjectType();
|
||||
|
||||
/**
|
||||
@@ -241,6 +248,7 @@ public abstract class AbstractFactoryBean<T>
|
||||
*/
|
||||
private class EarlySingletonInvocationHandler implements InvocationHandler {
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
if (ReflectionUtils.isEqualsMethod(method)) {
|
||||
// Only consider equal when proxies are identical.
|
||||
|
||||
@@ -108,6 +108,7 @@ public class BeanDefinitionHolder implements BeanMetadataElement {
|
||||
* Expose the bean definition's source object.
|
||||
* @see BeanDefinition#getSource()
|
||||
*/
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.beanDefinition.getSource();
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAw
|
||||
this.targetBeanName = targetBeanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
if (this.targetBeanName == null) {
|
||||
@@ -76,6 +77,7 @@ public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAw
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() throws BeansException {
|
||||
if (this.beanFactory == null) {
|
||||
throw new FactoryBeanNotInitializedException();
|
||||
@@ -83,6 +85,7 @@ public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAw
|
||||
return this.beanFactory.getBean(this.targetBeanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getObjectType() {
|
||||
if (this.beanFactory == null) {
|
||||
return null;
|
||||
@@ -90,6 +93,7 @@ public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAw
|
||||
return this.beanFactory.getType(this.targetBeanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
if (this.beanFactory == null) {
|
||||
throw new FactoryBeanNotInitializedException();
|
||||
@@ -97,6 +101,7 @@ public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAw
|
||||
return this.beanFactory.isSingleton(this.targetBeanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrototype() {
|
||||
if (this.beanFactory == null) {
|
||||
throw new FactoryBeanNotInitializedException();
|
||||
@@ -104,6 +109,7 @@ public class BeanReferenceFactoryBean implements SmartFactoryBean, BeanFactoryAw
|
||||
return this.beanFactory.isPrototype(this.targetBeanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEagerInit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,20 +53,24 @@ public class CommonsLogFactoryBean implements FactoryBean<Log>, InitializingBean
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (this.log == null) {
|
||||
throw new IllegalArgumentException("'logName' is required");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Log getObject() {
|
||||
return this.log;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Log> getObjectType() {
|
||||
return (this.log != null ? this.log.getClass() : Log.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -519,6 +519,7 @@ public class ConstructorArgumentValues {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, BeanCla
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
@@ -161,11 +162,13 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, BeanCla
|
||||
this.ignoreUnresolvableEditors = ignoreUnresolvableEditors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
if (this.propertyEditorRegistrars != null) {
|
||||
@@ -234,6 +237,7 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, BeanCla
|
||||
this.sharedEditor = sharedEditor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
||||
if (!(registry instanceof PropertyEditorRegistrySupport)) {
|
||||
throw new IllegalArgumentException("Cannot registered shared editor " +
|
||||
|
||||
@@ -65,15 +65,18 @@ public class CustomScopeConfigurer implements BeanFactoryPostProcessor, BeanClas
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
if (this.scopes != null) {
|
||||
|
||||
@@ -52,6 +52,7 @@ public class DeprecatedBeanWarner implements BeanFactoryPostProcessor {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
if (isLogEnabled()) {
|
||||
String[] beanNames = beanFactory.getBeanDefinitionNames();
|
||||
|
||||
@@ -142,15 +142,18 @@ public class FieldRetrievingFactoryBean
|
||||
* nor "targetField" have been specified.
|
||||
* This allows for concise bean definitions with just an id/name.
|
||||
*/
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
this.beanName = StringUtils.trimAllWhitespace(BeanFactoryUtils.originalBeanName(beanName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws ClassNotFoundException, NoSuchFieldException {
|
||||
if (this.targetClass != null && this.targetObject != null) {
|
||||
throw new IllegalArgumentException("Specify either targetClass or targetObject, not both");
|
||||
@@ -191,6 +194,7 @@ public class FieldRetrievingFactoryBean
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() throws IllegalAccessException {
|
||||
if (this.fieldObject == null) {
|
||||
throw new FactoryBeanNotInitializedException();
|
||||
@@ -206,10 +210,12 @@ public class FieldRetrievingFactoryBean
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return (this.fieldObject != null ? this.fieldObject.getType() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -39,26 +39,32 @@ import org.springframework.beans.PropertyValues;
|
||||
*/
|
||||
public abstract class InstantiationAwareBeanPostProcessorAdapter implements SmartInstantiationAwareBeanPostProcessor {
|
||||
|
||||
@Override
|
||||
public Class<?> predictBeanType(Class<?> beanClass, String beanName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, String beanName) throws BeansException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyValues postProcessPropertyValues(
|
||||
PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName)
|
||||
throws BeansException {
|
||||
@@ -66,10 +72,12 @@ public abstract class InstantiationAwareBeanPostProcessorAdapter implements Smar
|
||||
return pvs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@@ -110,10 +110,12 @@ public class MethodInvokingFactoryBean extends ArgumentConvertingMethodInvoker
|
||||
this.singleton = singleton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return this.singleton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
@@ -123,6 +125,7 @@ public class MethodInvokingFactoryBean extends ArgumentConvertingMethodInvoker
|
||||
return ClassUtils.forName(className, this.beanClassLoader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
if (beanFactory instanceof ConfigurableBeanFactory) {
|
||||
this.beanFactory = (ConfigurableBeanFactory) beanFactory;
|
||||
@@ -145,6 +148,7 @@ public class MethodInvokingFactoryBean extends ArgumentConvertingMethodInvoker
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
prepare();
|
||||
if (this.singleton) {
|
||||
@@ -178,6 +182,7 @@ public class MethodInvokingFactoryBean extends ArgumentConvertingMethodInvoker
|
||||
* to "true", otherwise returns the value returned from invoking the
|
||||
* specified method on the fly.
|
||||
*/
|
||||
@Override
|
||||
public Object getObject() throws Exception {
|
||||
if (this.singleton) {
|
||||
if (!this.initialized) {
|
||||
@@ -196,6 +201,7 @@ public class MethodInvokingFactoryBean extends ArgumentConvertingMethodInvoker
|
||||
* Return the type of object that this FactoryBean creates,
|
||||
* or {@code null} if not known in advance.
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
if (!isPrepared()) {
|
||||
// Not fully initialized yet -> return null to indicate "not known yet".
|
||||
|
||||
@@ -143,6 +143,7 @@ public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean<Object
|
||||
this.targetBeanName = targetBeanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() throws BeansException {
|
||||
return this.beanFactory.getBean(this.targetBeanName);
|
||||
}
|
||||
|
||||
@@ -174,6 +174,7 @@ public abstract class PlaceholderConfigurerSupport extends PropertyResourceConfi
|
||||
* @see #setLocations
|
||||
* @see org.springframework.core.io.ResourceEditor
|
||||
*/
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
@@ -186,6 +187,7 @@ public abstract class PlaceholderConfigurerSupport extends PropertyResourceConfi
|
||||
* @see #setLocations
|
||||
* @see org.springframework.core.io.ResourceEditor
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ public class PreferencesPlaceholderConfigurer extends PropertyPlaceholderConfigu
|
||||
* This implementation eagerly fetches the Preferences instances
|
||||
* for the required system and user tree nodes.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
this.systemPrefs = (this.systemTreePath != null) ?
|
||||
Preferences.systemRoot().node(this.systemTreePath) : Preferences.systemRoot();
|
||||
|
||||
@@ -59,17 +59,20 @@ public class PropertiesFactoryBean extends PropertiesLoaderSupport
|
||||
this.singleton = singleton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isSingleton() {
|
||||
return this.singleton;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void afterPropertiesSet() throws IOException {
|
||||
if (this.singleton) {
|
||||
this.singletonInstance = createProperties();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Properties getObject() throws IOException {
|
||||
if (this.singleton) {
|
||||
return this.singletonInstance;
|
||||
@@ -79,6 +82,7 @@ public class PropertiesFactoryBean extends PropertiesLoaderSupport
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Properties> getObjectType() {
|
||||
return Properties.class;
|
||||
}
|
||||
|
||||
@@ -147,11 +147,13 @@ public class PropertyPathFactoryBean implements FactoryBean<Object>, BeanNameAwa
|
||||
* "targetBeanName" nor "propertyPath" have been specified.
|
||||
* This allows for concise bean definitions with just an id/name.
|
||||
*/
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
this.beanName = StringUtils.trimAllWhitespace(BeanFactoryUtils.originalBeanName(beanName));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
|
||||
@@ -190,6 +192,7 @@ public class PropertyPathFactoryBean implements FactoryBean<Object>, BeanNameAwa
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() throws BeansException {
|
||||
BeanWrapper target = this.targetBeanWrapper;
|
||||
if (target != null) {
|
||||
@@ -208,6 +211,7 @@ public class PropertyPathFactoryBean implements FactoryBean<Object>, BeanNameAwa
|
||||
return target.getPropertyValue(this.propertyPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return this.resultType;
|
||||
}
|
||||
@@ -218,6 +222,7 @@ public class PropertyPathFactoryBean implements FactoryBean<Object>, BeanNameAwa
|
||||
* for each call, so we have to assume that we're not returning the
|
||||
* same object for each {@link #getObject()} call.
|
||||
*/
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -251,6 +251,7 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
|
||||
this.resolver = new PropertyPlaceholderConfigurerResolver(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolveStringValue(String strVal) throws BeansException {
|
||||
String value = this.helper.replacePlaceholders(strVal, this.resolver);
|
||||
return (value.equals(nullValue) ? null : value);
|
||||
@@ -266,6 +267,7 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
|
||||
this.props = props;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolvePlaceholder(String placeholderName) {
|
||||
return PropertyPlaceholderConfigurer.this.resolvePlaceholder(placeholderName, props, systemPropertiesMode);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public abstract class PropertyResourceConfigurer extends PropertiesLoaderSupport
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
@@ -73,6 +74,7 @@ public abstract class PropertyResourceConfigurer extends PropertiesLoaderSupport
|
||||
* {@linkplain #processProperties process} properties against the given bean factory.
|
||||
* @throws BeanInitializationException if any properties cannot be loaded
|
||||
*/
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
try {
|
||||
Properties mergedProps = mergeProperties();
|
||||
|
||||
@@ -88,6 +88,7 @@ public class ProviderCreatingFactoryBean extends AbstractFactoryBean<Provider> {
|
||||
this.targetBeanName = targetBeanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() throws BeansException {
|
||||
return this.beanFactory.getBean(this.targetBeanName);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public class RuntimeBeanNameReference implements BeanReference {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBeanName() {
|
||||
return this.beanName;
|
||||
}
|
||||
@@ -56,6 +57,7 @@ public class RuntimeBeanNameReference implements BeanReference {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ public class RuntimeBeanReference implements BeanReference {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getBeanName() {
|
||||
return this.beanName;
|
||||
}
|
||||
@@ -81,6 +82,7 @@ public class RuntimeBeanReference implements BeanReference {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -246,6 +246,7 @@ public class ServiceLocatorFactoryBean implements FactoryBean<Object>, BeanFacto
|
||||
this.serviceMappings = serviceMappings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
if (!(beanFactory instanceof ListableBeanFactory)) {
|
||||
throw new FatalBeanException(
|
||||
@@ -254,6 +255,7 @@ public class ServiceLocatorFactoryBean implements FactoryBean<Object>, BeanFacto
|
||||
this.beanFactory = (ListableBeanFactory) beanFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (this.serviceLocatorInterface == null) {
|
||||
throw new IllegalArgumentException("Property 'serviceLocatorInterface' is required");
|
||||
@@ -323,14 +325,17 @@ public class ServiceLocatorFactoryBean implements FactoryBean<Object>, BeanFacto
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return this.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return this.serviceLocatorInterface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
@@ -341,6 +346,7 @@ public class ServiceLocatorFactoryBean implements FactoryBean<Object>, BeanFacto
|
||||
*/
|
||||
private class ServiceLocatorInvocationHandler implements InvocationHandler {
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
if (ReflectionUtils.isEqualsMethod(method)) {
|
||||
// Only consider equal when proxies are identical.
|
||||
|
||||
@@ -171,6 +171,7 @@ public class TypedStringValue implements BeanMetadataElement {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public abstract class AbstractComponentDefinition implements ComponentDefinition
|
||||
/**
|
||||
* Delegates to {@link #getName}.
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return getName();
|
||||
}
|
||||
@@ -42,6 +43,7 @@ public abstract class AbstractComponentDefinition implements ComponentDefinition
|
||||
/**
|
||||
* Returns an empty array.
|
||||
*/
|
||||
@Override
|
||||
public BeanDefinition[] getBeanDefinitions() {
|
||||
return new BeanDefinition[0];
|
||||
}
|
||||
@@ -49,6 +51,7 @@ public abstract class AbstractComponentDefinition implements ComponentDefinition
|
||||
/**
|
||||
* Returns an empty array.
|
||||
*/
|
||||
@Override
|
||||
public BeanDefinition[] getInnerBeanDefinitions() {
|
||||
return new BeanDefinition[0];
|
||||
}
|
||||
@@ -56,6 +59,7 @@ public abstract class AbstractComponentDefinition implements ComponentDefinition
|
||||
/**
|
||||
* Returns an empty array.
|
||||
*/
|
||||
@Override
|
||||
public BeanReference[] getBeanReferences() {
|
||||
return new BeanReference[0];
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ public class AliasDefinition implements BeanMetadataElement {
|
||||
return this.alias;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -94,22 +94,27 @@ public class BeanComponentDefinition extends BeanDefinitionHolder implements Com
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getBeanName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return getShortDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanDefinition[] getBeanDefinitions() {
|
||||
return new BeanDefinition[] {getBeanDefinition()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanDefinition[] getInnerBeanDefinitions() {
|
||||
return this.innerBeanDefinitions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanReference[] getBeanReferences() {
|
||||
return this.beanReferences;
|
||||
}
|
||||
|
||||
@@ -51,10 +51,12 @@ public class CompositeComponentDefinition extends AbstractComponentDefinition {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -25,18 +25,22 @@ package org.springframework.beans.factory.parsing;
|
||||
*/
|
||||
public class EmptyReaderEventListener implements ReaderEventListener {
|
||||
|
||||
@Override
|
||||
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentRegistered(ComponentDefinition componentDefinition) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void aliasRegistered(AliasDefinition aliasDefinition) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importProcessed(ImportDefinition importDefinition) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public class FailFastProblemReporter implements ProblemReporter {
|
||||
* that has occurred.
|
||||
* @param problem the source of the error
|
||||
*/
|
||||
@Override
|
||||
public void fatal(Problem problem) {
|
||||
throw new BeanDefinitionParsingException(problem);
|
||||
}
|
||||
@@ -64,6 +65,7 @@ public class FailFastProblemReporter implements ProblemReporter {
|
||||
* that has occurred.
|
||||
* @param problem the source of the error
|
||||
*/
|
||||
@Override
|
||||
public void error(Problem problem) {
|
||||
throw new BeanDefinitionParsingException(problem);
|
||||
}
|
||||
@@ -72,6 +74,7 @@ public class FailFastProblemReporter implements ProblemReporter {
|
||||
* Writes the supplied {@link Problem} to the {@link Log} at {@code WARN} level.
|
||||
* @param problem the source of the warning
|
||||
*/
|
||||
@Override
|
||||
public void warning(Problem problem) {
|
||||
this.logger.warn(problem, problem.getRootCause());
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ public class ImportDefinition implements BeanMetadataElement {
|
||||
return this.actualResources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ public class NullSourceExtractor implements SourceExtractor {
|
||||
/**
|
||||
* This implementation simply returns {@code null} for any input.
|
||||
*/
|
||||
@Override
|
||||
public Object extractSource(Object sourceCandidate, Resource definitionResource) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public class PassThroughSourceExtractor implements SourceExtractor {
|
||||
* @param sourceCandidate the source metadata
|
||||
* @return the supplied {@code sourceCandidate}
|
||||
*/
|
||||
@Override
|
||||
public Object extractSource(Object sourceCandidate, Resource definingResource) {
|
||||
return sourceCandidate;
|
||||
}
|
||||
|
||||
@@ -280,6 +280,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
// Typical methods for creating and populating external bean instances
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T createBean(Class<T> beanClass) throws BeansException {
|
||||
// Use prototype bean definition, to avoid registering bean as dependent bean.
|
||||
@@ -289,6 +290,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
return (T) createBean(beanClass.getName(), bd, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autowireBean(Object existingBean) {
|
||||
// Use non-singleton bean definition, to avoid registering bean as dependent bean.
|
||||
RootBeanDefinition bd = new RootBeanDefinition(ClassUtils.getUserClass(existingBean));
|
||||
@@ -299,6 +301,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
populateBean(bd.getBeanClass().getName(), bd, bw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object configureBean(Object existingBean, String beanName) throws BeansException {
|
||||
markBeanAsCreated(beanName);
|
||||
BeanDefinition mbd = getMergedBeanDefinition(beanName);
|
||||
@@ -320,6 +323,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
return initializeBean(beanName, existingBean, bd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveDependency(DependencyDescriptor descriptor, String beanName) throws BeansException {
|
||||
return resolveDependency(descriptor, beanName, null, null);
|
||||
}
|
||||
@@ -329,6 +333,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
// Specialized methods for fine-grained control over the bean lifecycle
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
|
||||
// Use non-singleton bean definition, to avoid registering bean as dependent bean.
|
||||
RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck);
|
||||
@@ -336,6 +341,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
return createBean(beanClass.getName(), bd, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
|
||||
// Use non-singleton bean definition, to avoid registering bean as dependent bean.
|
||||
final RootBeanDefinition bd = new RootBeanDefinition(beanClass, autowireMode, dependencyCheck);
|
||||
@@ -350,6 +356,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
if (System.getSecurityManager() != null) {
|
||||
bean = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
|
||||
@Override
|
||||
public Object run() {
|
||||
return getInstantiationStrategy().instantiate(bd, null, parent);
|
||||
}
|
||||
@@ -364,6 +371,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autowireBeanProperties(Object existingBean, int autowireMode, boolean dependencyCheck)
|
||||
throws BeansException {
|
||||
|
||||
@@ -379,6 +387,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
populateBean(bd.getBeanClass().getName(), bd, bw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyBeanPropertyValues(Object existingBean, String beanName) throws BeansException {
|
||||
markBeanAsCreated(beanName);
|
||||
BeanDefinition bd = getMergedBeanDefinition(beanName);
|
||||
@@ -387,10 +396,12 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
applyPropertyValues(beanName, bd, bw, bd.getPropertyValues());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object initializeBean(Object existingBean, String beanName) {
|
||||
return initializeBean(beanName, existingBean, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName)
|
||||
throws BeansException {
|
||||
|
||||
@@ -404,6 +415,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object applyBeanPostProcessorsAfterInitialization(Object existingBean, String beanName)
|
||||
throws BeansException {
|
||||
|
||||
@@ -510,6 +522,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
"' to allow for resolving potential circular references");
|
||||
}
|
||||
addSingletonFactory(beanName, new ObjectFactory() {
|
||||
@Override
|
||||
public Object getObject() throws BeansException {
|
||||
return getEarlyBeanReference(beanName, mbd, bean);
|
||||
}
|
||||
@@ -695,6 +708,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
// @Bean methods, there may be parameters present.
|
||||
ReflectionUtils.doWithMethods(fbClass,
|
||||
new ReflectionUtils.MethodCallback() {
|
||||
@Override
|
||||
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
|
||||
if (method.getName().equals(factoryMethodName) &&
|
||||
FactoryBean.class.isAssignableFrom(method.getReturnType())) {
|
||||
@@ -995,6 +1009,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
final BeanFactory parent = this;
|
||||
if (System.getSecurityManager() != null) {
|
||||
beanInstance = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
return getInstantiationStrategy().instantiate(mbd, beanName, parent);
|
||||
}
|
||||
@@ -1464,6 +1479,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
protected Object initializeBean(final String beanName, final Object bean, RootBeanDefinition mbd) {
|
||||
if (System.getSecurityManager() != null) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
invokeAwareMethods(beanName, bean);
|
||||
return null;
|
||||
@@ -1531,6 +1547,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
if (System.getSecurityManager() != null) {
|
||||
try {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
((InitializingBean) bean).afterPropertiesSet();
|
||||
return null;
|
||||
@@ -1588,6 +1605,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
|
||||
if (System.getSecurityManager() != null) {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
ReflectionUtils.makeAccessible(initMethod);
|
||||
return null;
|
||||
@@ -1595,6 +1613,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
});
|
||||
try {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
initMethod.invoke(bean);
|
||||
return null;
|
||||
|
||||
@@ -386,10 +386,12 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
return (Class) beanClassObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassName(String beanClassName) {
|
||||
this.beanClass = beanClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBeanClassName() {
|
||||
Object beanClassObject = this.beanClass;
|
||||
if (beanClassObject instanceof Class) {
|
||||
@@ -429,6 +431,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* @see #SCOPE_SINGLETON
|
||||
* @see #SCOPE_PROTOTYPE
|
||||
*/
|
||||
@Override
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
this.singleton = SCOPE_SINGLETON.equals(scope) || SCOPE_DEFAULT.equals(scope);
|
||||
@@ -438,6 +441,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
/**
|
||||
* Return the name of the target scope for the bean.
|
||||
*/
|
||||
@Override
|
||||
public String getScope() {
|
||||
return this.scope;
|
||||
}
|
||||
@@ -467,6 +471,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* returned from all calls.
|
||||
* @see #SCOPE_SINGLETON
|
||||
*/
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return this.singleton;
|
||||
}
|
||||
@@ -476,6 +481,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* returned for each call.
|
||||
* @see #SCOPE_PROTOTYPE
|
||||
*/
|
||||
@Override
|
||||
public boolean isPrototype() {
|
||||
return this.prototype;
|
||||
}
|
||||
@@ -494,6 +500,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* Return whether this bean is "abstract", i.e. not meant to be instantiated
|
||||
* itself but rather just serving as parent for concrete child bean definitions.
|
||||
*/
|
||||
@Override
|
||||
public boolean isAbstract() {
|
||||
return this.abstractFlag;
|
||||
}
|
||||
@@ -503,6 +510,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* <p>If {@code false}, the bean will get instantiated on startup by bean
|
||||
* factories that perform eager initialization of singletons.
|
||||
*/
|
||||
@Override
|
||||
public void setLazyInit(boolean lazyInit) {
|
||||
this.lazyInit = lazyInit;
|
||||
}
|
||||
@@ -511,6 +519,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* Return whether this bean should be lazily initialized, i.e. not
|
||||
* eagerly instantiated on startup. Only applicable to a singleton bean.
|
||||
*/
|
||||
@Override
|
||||
public boolean isLazyInit() {
|
||||
return this.lazyInit;
|
||||
}
|
||||
@@ -591,6 +600,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* constructor arguments. This property should just be necessary for other kinds
|
||||
* of dependencies like statics (*ugh*) or database preparation on startup.
|
||||
*/
|
||||
@Override
|
||||
public void setDependsOn(String[] dependsOn) {
|
||||
this.dependsOn = dependsOn;
|
||||
}
|
||||
@@ -598,6 +608,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
/**
|
||||
* Return the bean names that this bean depends on.
|
||||
*/
|
||||
@Override
|
||||
public String[] getDependsOn() {
|
||||
return this.dependsOn;
|
||||
}
|
||||
@@ -605,6 +616,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
/**
|
||||
* Set whether this bean is a candidate for getting autowired into some other bean.
|
||||
*/
|
||||
@Override
|
||||
public void setAutowireCandidate(boolean autowireCandidate) {
|
||||
this.autowireCandidate = autowireCandidate;
|
||||
}
|
||||
@@ -612,6 +624,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
/**
|
||||
* Return whether this bean is a candidate for getting autowired into some other bean.
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutowireCandidate() {
|
||||
return this.autowireCandidate;
|
||||
}
|
||||
@@ -621,6 +634,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* If this value is true for exactly one bean among multiple
|
||||
* matching candidates, it will serve as a tie-breaker.
|
||||
*/
|
||||
@Override
|
||||
public void setPrimary(boolean primary) {
|
||||
this.primary = primary;
|
||||
}
|
||||
@@ -630,6 +644,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* If this value is true for exactly one bean among multiple
|
||||
* matching candidates, it will serve as a tie-breaker.
|
||||
*/
|
||||
@Override
|
||||
public boolean isPrimary() {
|
||||
return this.primary;
|
||||
}
|
||||
@@ -724,6 +739,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
/**
|
||||
* Return constructor argument values for this bean (never {@code null}).
|
||||
*/
|
||||
@Override
|
||||
public ConstructorArgumentValues getConstructorArgumentValues() {
|
||||
return this.constructorArgumentValues;
|
||||
}
|
||||
@@ -745,6 +761,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
/**
|
||||
* Return property values for this bean (never {@code null}).
|
||||
*/
|
||||
@Override
|
||||
public MutablePropertyValues getPropertyValues() {
|
||||
return this.propertyValues;
|
||||
}
|
||||
@@ -766,18 +783,22 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setFactoryBeanName(String factoryBeanName) {
|
||||
this.factoryBeanName = factoryBeanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFactoryBeanName() {
|
||||
return this.factoryBeanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFactoryMethodName(String factoryMethodName) {
|
||||
this.factoryMethodName = factoryMethodName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFactoryMethodName() {
|
||||
return this.factoryMethodName;
|
||||
}
|
||||
@@ -874,6 +895,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
/**
|
||||
* Return the role hint for this {@code BeanDefinition}.
|
||||
*/
|
||||
@Override
|
||||
public int getRole() {
|
||||
return this.role;
|
||||
}
|
||||
@@ -886,6 +908,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
@@ -913,6 +936,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
this.resource = new DescriptiveResource(resourceDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResourceDescription() {
|
||||
return (this.resource != null ? this.resource.getDescription() : null);
|
||||
}
|
||||
@@ -924,6 +948,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
this.resource = new BeanDefinitionResource(originatingBd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanDefinition getOriginatingBeanDefinition() {
|
||||
return (this.resource instanceof BeanDefinitionResource ?
|
||||
((BeanDefinitionResource) this.resource).getBeanDefinition() : null);
|
||||
|
||||
@@ -102,6 +102,7 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable
|
||||
return this.registry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BeanDefinitionRegistry getRegistry() {
|
||||
return this.registry;
|
||||
}
|
||||
@@ -121,6 +122,7 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable
|
||||
this.resourceLoader = resourceLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLoader getResourceLoader() {
|
||||
return this.resourceLoader;
|
||||
}
|
||||
@@ -136,6 +138,7 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getBeanClassLoader() {
|
||||
return this.beanClassLoader;
|
||||
}
|
||||
@@ -149,6 +152,7 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Environment getEnvironment() {
|
||||
return this.environment;
|
||||
}
|
||||
@@ -162,11 +166,13 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable
|
||||
this.beanNameGenerator = (beanNameGenerator != null ? beanNameGenerator : new DefaultBeanNameGenerator());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanNameGenerator getBeanNameGenerator() {
|
||||
return this.beanNameGenerator;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int loadBeanDefinitions(Resource... resources) throws BeanDefinitionStoreException {
|
||||
Assert.notNull(resources, "Resource array must not be null");
|
||||
int counter = 0;
|
||||
@@ -176,6 +182,7 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable
|
||||
return counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int loadBeanDefinitions(String location) throws BeanDefinitionStoreException {
|
||||
return loadBeanDefinitions(location, null);
|
||||
}
|
||||
@@ -236,6 +243,7 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int loadBeanDefinitions(String... locations) throws BeanDefinitionStoreException {
|
||||
Assert.notNull(locations, "Location array must not be null");
|
||||
int counter = 0;
|
||||
|
||||
@@ -190,14 +190,17 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
// Implementation of BeanFactory interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Object getBean(String name) throws BeansException {
|
||||
return doGetBean(name, null, null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getBean(String name, Class<T> requiredType) throws BeansException {
|
||||
return doGetBean(name, requiredType, null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean(String name, Object... args) throws BeansException {
|
||||
return doGetBean(name, null, args, false);
|
||||
}
|
||||
@@ -290,6 +293,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
// Create bean instance.
|
||||
if (mbd.isSingleton()) {
|
||||
sharedInstance = getSingleton(beanName, new ObjectFactory<Object>() {
|
||||
@Override
|
||||
public Object getObject() throws BeansException {
|
||||
try {
|
||||
return createBean(beanName, mbd, args);
|
||||
@@ -327,6 +331,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
}
|
||||
try {
|
||||
Object scopedInstance = scope.get(beanName, new ObjectFactory<Object>() {
|
||||
@Override
|
||||
public Object getObject() throws BeansException {
|
||||
beforePrototypeCreation(beanName);
|
||||
try {
|
||||
@@ -364,6 +369,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
return (T) bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsBean(String name) {
|
||||
String beanName = transformedBeanName(name);
|
||||
if (containsSingleton(beanName) || containsBeanDefinition(beanName)) {
|
||||
@@ -374,6 +380,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
return (parentBeanFactory != null && parentBeanFactory.containsBean(originalBeanName(name)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
|
||||
String beanName = transformedBeanName(name);
|
||||
|
||||
@@ -419,6 +426,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrototype(String name) throws NoSuchBeanDefinitionException {
|
||||
String beanName = transformedBeanName(name);
|
||||
|
||||
@@ -443,6 +451,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
final FactoryBean<?> factoryBean = (FactoryBean<?>) getBean(FACTORY_BEAN_PREFIX + beanName);
|
||||
if (System.getSecurityManager() != null) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||
@Override
|
||||
public Boolean run() {
|
||||
return ((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean<?>) factoryBean).isPrototype()) ||
|
||||
!factoryBean.isSingleton());
|
||||
@@ -460,6 +469,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTypeMatch(String name, Class<?> targetType) throws NoSuchBeanDefinitionException {
|
||||
String beanName = transformedBeanName(name);
|
||||
Class<?> typeToMatch = (targetType != null ? targetType : Object.class);
|
||||
@@ -531,6 +541,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType(String name) throws NoSuchBeanDefinitionException {
|
||||
String beanName = transformedBeanName(name);
|
||||
|
||||
@@ -621,10 +632,12 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
// Implementation of HierarchicalBeanFactory interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public BeanFactory getParentBeanFactory() {
|
||||
return this.parentBeanFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsLocalBean(String name) {
|
||||
String beanName = transformedBeanName(name);
|
||||
return ((containsSingleton(beanName) || containsBeanDefinition(beanName)) &&
|
||||
@@ -636,6 +649,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
// Implementation of ConfigurableBeanFactory interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void setParentBeanFactory(BeanFactory parentBeanFactory) {
|
||||
if (this.parentBeanFactory != null && this.parentBeanFactory != parentBeanFactory) {
|
||||
throw new IllegalStateException("Already associated with parent BeanFactory: " + this.parentBeanFactory);
|
||||
@@ -643,46 +657,57 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
this.parentBeanFactory = parentBeanFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = (beanClassLoader != null ? beanClassLoader : ClassUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getBeanClassLoader() {
|
||||
return this.beanClassLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTempClassLoader(ClassLoader tempClassLoader) {
|
||||
this.tempClassLoader = tempClassLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getTempClassLoader() {
|
||||
return this.tempClassLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCacheBeanMetadata(boolean cacheBeanMetadata) {
|
||||
this.cacheBeanMetadata = cacheBeanMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCacheBeanMetadata() {
|
||||
return this.cacheBeanMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanExpressionResolver(BeanExpressionResolver resolver) {
|
||||
this.beanExpressionResolver = resolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanExpressionResolver getBeanExpressionResolver() {
|
||||
return this.beanExpressionResolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConversionService(ConversionService conversionService) {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConversionService getConversionService() {
|
||||
return this.conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyEditorRegistrar(PropertyEditorRegistrar registrar) {
|
||||
Assert.notNull(registrar, "PropertyEditorRegistrar must not be null");
|
||||
this.propertyEditorRegistrars.add(registrar);
|
||||
@@ -695,12 +720,14 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
return this.propertyEditorRegistrars;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCustomEditor(Class<?> requiredType, Class<? extends PropertyEditor> propertyEditorClass) {
|
||||
Assert.notNull(requiredType, "Required type must not be null");
|
||||
Assert.isAssignable(PropertyEditor.class, propertyEditorClass);
|
||||
this.customEditors.put(requiredType, propertyEditorClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyRegisteredEditorsTo(PropertyEditorRegistry registry) {
|
||||
registerCustomEditors(registry);
|
||||
}
|
||||
@@ -712,6 +739,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
return this.customEditors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeConverter(TypeConverter typeConverter) {
|
||||
this.typeConverter = typeConverter;
|
||||
}
|
||||
@@ -724,6 +752,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
return this.typeConverter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeConverter getTypeConverter() {
|
||||
TypeConverter customConverter = getCustomTypeConverter();
|
||||
if (customConverter != null) {
|
||||
@@ -738,11 +767,13 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEmbeddedValueResolver(StringValueResolver valueResolver) {
|
||||
Assert.notNull(valueResolver, "StringValueResolver must not be null");
|
||||
this.embeddedValueResolvers.add(valueResolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolveEmbeddedValue(String value) {
|
||||
String result = value;
|
||||
for (StringValueResolver resolver : this.embeddedValueResolvers) {
|
||||
@@ -751,6 +782,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor) {
|
||||
Assert.notNull(beanPostProcessor, "BeanPostProcessor must not be null");
|
||||
this.beanPostProcessors.remove(beanPostProcessor);
|
||||
@@ -763,6 +795,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBeanPostProcessorCount() {
|
||||
return this.beanPostProcessors.size();
|
||||
}
|
||||
@@ -795,6 +828,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
return this.hasDestructionAwareBeanPostProcessors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerScope(String scopeName, Scope scope) {
|
||||
Assert.notNull(scopeName, "Scope identifier must not be null");
|
||||
Assert.notNull(scope, "Scope must not be null");
|
||||
@@ -804,10 +838,12 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
this.scopes.put(scopeName, scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getRegisteredScopeNames() {
|
||||
return StringUtils.toStringArray(this.scopes.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Scope getRegisteredScope(String scopeName) {
|
||||
Assert.notNull(scopeName, "Scope identifier must not be null");
|
||||
return this.scopes.get(scopeName);
|
||||
@@ -833,6 +869,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
AccessController.getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) {
|
||||
Assert.notNull(otherFactory, "BeanFactory must not be null");
|
||||
setBeanClassLoader(otherFactory.getBeanClassLoader());
|
||||
@@ -866,6 +903,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
* @throws NoSuchBeanDefinitionException if there is no bean with the given name
|
||||
* @throws BeanDefinitionStoreException in case of an invalid bean definition
|
||||
*/
|
||||
@Override
|
||||
public BeanDefinition getMergedBeanDefinition(String name) throws BeansException {
|
||||
String beanName = transformedBeanName(name);
|
||||
|
||||
@@ -877,6 +915,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
return getMergedLocalBeanDefinition(beanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFactoryBean(String name) throws NoSuchBeanDefinitionException {
|
||||
String beanName = transformedBeanName(name);
|
||||
|
||||
@@ -959,6 +998,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyBean(String beanName, Object beanInstance) {
|
||||
destroyBean(beanName, beanInstance, getMergedLocalBeanDefinition(beanName));
|
||||
}
|
||||
@@ -974,6 +1014,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
new DisposableBeanAdapter(beanInstance, beanName, mbd, getBeanPostProcessors(), getAccessControlContext()).destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyScopedBean(String beanName) {
|
||||
RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName);
|
||||
if (mbd.isSingleton() || mbd.isPrototype()) {
|
||||
@@ -1246,6 +1287,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
}
|
||||
if (System.getSecurityManager() != null) {
|
||||
return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
|
||||
@Override
|
||||
public Class<?> run() throws Exception {
|
||||
return doResolveBeanClass(mbd, typesToMatch);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ abstract class AutowireUtils {
|
||||
*/
|
||||
public static void sortConstructors(Constructor[] constructors) {
|
||||
Arrays.sort(constructors, new Comparator<Constructor>() {
|
||||
@Override
|
||||
public int compare(Constructor c1, Constructor c2) {
|
||||
boolean p1 = Modifier.isPublic(c1.getModifiers());
|
||||
boolean p2 = Modifier.isPublic(c2.getModifiers());
|
||||
@@ -73,6 +74,7 @@ abstract class AutowireUtils {
|
||||
*/
|
||||
public static void sortFactoryMethods(Method[] factoryMethods) {
|
||||
Arrays.sort(factoryMethods, new Comparator<Method>() {
|
||||
@Override
|
||||
public int compare(Method fm1, Method fm2) {
|
||||
boolean p1 = Modifier.isPublic(fm1.getModifiers());
|
||||
boolean p2 = Modifier.isPublic(fm2.getModifiers());
|
||||
@@ -162,6 +164,7 @@ abstract class AutowireUtils {
|
||||
this.objectFactory = objectFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
String methodName = method.getName();
|
||||
if (methodName.equals("equals")) {
|
||||
|
||||
@@ -64,11 +64,13 @@ class BeanDefinitionResource extends AbstractResource {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
throw new FileNotFoundException(
|
||||
"Resource cannot be opened because it points to " + getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "BeanDefinition defined in " + this.beanDefinition.getResourceDescription();
|
||||
}
|
||||
|
||||
@@ -153,6 +153,7 @@ public class CglibSubclassingInstantiationStrategy extends SimpleInstantiationSt
|
||||
*/
|
||||
private class LookupOverrideMethodInterceptor extends CglibIdentitySupport implements MethodInterceptor {
|
||||
|
||||
@Override
|
||||
public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp) throws Throwable {
|
||||
// Cast is safe, as CallbackFilter filters are used selectively.
|
||||
LookupOverride lo = (LookupOverride) beanDefinition.getMethodOverrides().getOverride(method);
|
||||
@@ -167,6 +168,7 @@ public class CglibSubclassingInstantiationStrategy extends SimpleInstantiationSt
|
||||
*/
|
||||
private class ReplaceOverrideMethodInterceptor extends CglibIdentitySupport implements MethodInterceptor {
|
||||
|
||||
@Override
|
||||
public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp) throws Throwable {
|
||||
ReplaceOverride ro = (ReplaceOverride) beanDefinition.getMethodOverrides().getOverride(method);
|
||||
// TODO could cache if a singleton for minor performance optimization
|
||||
@@ -181,6 +183,7 @@ public class CglibSubclassingInstantiationStrategy extends SimpleInstantiationSt
|
||||
*/
|
||||
private class CallbackFilterImpl extends CglibIdentitySupport implements CallbackFilter {
|
||||
|
||||
@Override
|
||||
public int accept(Method method) {
|
||||
MethodOverride methodOverride = beanDefinition.getMethodOverrides().getOverride(method);
|
||||
if (logger.isTraceEnabled()) {
|
||||
|
||||
@@ -132,10 +132,12 @@ public class ChildBeanDefinition extends AbstractBeanDefinition {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setParentName(String parentName) {
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParentName() {
|
||||
return this.parentName;
|
||||
}
|
||||
|
||||
@@ -270,6 +270,7 @@ class ConstructorResolver {
|
||||
final Constructor ctorToUse = constructorToUse;
|
||||
final Object[] argumentsToUse = argsToUse;
|
||||
beanInstance = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
return beanFactory.getInstantiationStrategy().instantiate(
|
||||
mbd, beanName, beanFactory, ctorToUse, argumentsToUse);
|
||||
@@ -402,6 +403,7 @@ class ConstructorResolver {
|
||||
final Class factoryClazz = factoryClass;
|
||||
if (System.getSecurityManager() != null) {
|
||||
rawCandidates = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
|
||||
@Override
|
||||
public Method[] run() {
|
||||
return (mbd.isNonPublicAccessAllowed() ?
|
||||
ReflectionUtils.getAllDeclaredMethods(factoryClazz) : factoryClazz.getMethods());
|
||||
@@ -560,6 +562,7 @@ class ConstructorResolver {
|
||||
final Method factoryMethod = factoryMethodToUse;
|
||||
final Object[] args = argsToUse;
|
||||
beanInstance = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
return beanFactory.getInstantiationStrategy().instantiate(
|
||||
mbd, beanName, beanFactory, fb, factoryMethod, args);
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
||||
*/
|
||||
public class DefaultBeanNameGenerator implements BeanNameGenerator {
|
||||
|
||||
@Override
|
||||
public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
|
||||
return BeanDefinitionReaderUtils.generateBeanName(definition, registry);
|
||||
}
|
||||
|
||||
@@ -215,6 +215,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
if (System.getSecurityManager() != null) {
|
||||
final BeanFactory target = this;
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
((BeanFactoryAware) autowireCandidateResolver).setBeanFactory(target);
|
||||
return null;
|
||||
@@ -253,6 +254,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
// Implementation of ListableBeanFactory interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public <T> T getBean(Class<T> requiredType) throws BeansException {
|
||||
Assert.notNull(requiredType, "Required type must not be null");
|
||||
String[] beanNames = getBeanNamesForType(requiredType);
|
||||
@@ -285,10 +287,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
return this.beanDefinitionMap.containsKey(beanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBeanDefinitionCount() {
|
||||
return this.beanDefinitionMap.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanDefinitionNames() {
|
||||
synchronized (this.beanDefinitionMap) {
|
||||
if (this.frozenBeanDefinitionNames != null) {
|
||||
@@ -300,10 +304,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(Class<?> type) {
|
||||
return getBeanNamesForType(type, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
|
||||
if (!isConfigurationFrozen() || type == null || !allowEagerInit) {
|
||||
return doGetBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
||||
@@ -407,10 +413,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
return (factoryBeanName != null && isFactoryBean(factoryBeanName) && !containsSingleton(factoryBeanName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException {
|
||||
return getBeansOfType(type, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
|
||||
throws BeansException {
|
||||
|
||||
@@ -441,6 +449,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) {
|
||||
Set<String> beanNames = new LinkedHashSet<String>(getBeanDefinitionCount());
|
||||
beanNames.addAll(Arrays.asList(getBeanDefinitionNames()));
|
||||
@@ -460,6 +469,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
* found on the given class itself, as well as checking its raw bean class
|
||||
* if not found on the exposed bean reference (e.g. in case of a proxy).
|
||||
*/
|
||||
@Override
|
||||
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) {
|
||||
A ann = null;
|
||||
Class<?> beanType = getType(beanName);
|
||||
@@ -483,6 +493,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
// Implementation of ConfigurableListableBeanFactory interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void registerResolvableDependency(Class<?> dependencyType, Object autowiredValue) {
|
||||
Assert.notNull(dependencyType, "Type must not be null");
|
||||
if (autowiredValue != null) {
|
||||
@@ -492,6 +503,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutowireCandidate(String beanName, DependencyDescriptor descriptor)
|
||||
throws NoSuchBeanDefinitionException {
|
||||
|
||||
@@ -552,6 +564,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
return bd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void freezeConfiguration() {
|
||||
this.configurationFrozen = true;
|
||||
synchronized (this.beanDefinitionMap) {
|
||||
@@ -559,6 +572,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConfigurationFrozen() {
|
||||
return this.configurationFrozen;
|
||||
}
|
||||
@@ -573,6 +587,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
return (this.configurationFrozen || super.isBeanEligibleForMetadataCaching(beanName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInstantiateSingletons() throws BeansException {
|
||||
if (this.logger.isInfoEnabled()) {
|
||||
this.logger.info("Pre-instantiating singletons in " + this);
|
||||
@@ -591,6 +606,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
boolean isEagerInit;
|
||||
if (System.getSecurityManager() != null && factory instanceof SmartFactoryBean) {
|
||||
isEagerInit = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||
@Override
|
||||
public Boolean run() {
|
||||
return ((SmartFactoryBean<?>) factory).isEagerInit();
|
||||
}
|
||||
@@ -616,6 +632,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
// Implementation of BeanDefinitionRegistry interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition)
|
||||
throws BeanDefinitionStoreException {
|
||||
|
||||
@@ -657,6 +674,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
resetBeanDefinition(beanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBeanDefinition(String beanName) throws NoSuchBeanDefinitionException {
|
||||
Assert.hasText(beanName, "'beanName' must not be empty");
|
||||
|
||||
@@ -717,6 +735,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
// Dependency resolution functionality
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Object resolveDependency(DependencyDescriptor descriptor, String beanName,
|
||||
Set<String> autowiredBeanNames, TypeConverter typeConverter) throws BeansException {
|
||||
|
||||
@@ -1032,6 +1051,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
this.beanName = beanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() throws BeansException {
|
||||
return doResolveDependency(this.descriptor, this.descriptor.getDependencyType(), this.beanName, null, null);
|
||||
}
|
||||
@@ -1047,6 +1067,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
super(descriptor, beanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() throws BeansException {
|
||||
return getObject();
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
private final Map<String, Set<String>> dependenciesForBeanMap = new ConcurrentHashMap<String, Set<String>>(64);
|
||||
|
||||
|
||||
@Override
|
||||
public void registerSingleton(String beanName, Object singletonObject) throws IllegalStateException {
|
||||
Assert.notNull(beanName, "'beanName' must not be null");
|
||||
synchronized (this.singletonObjects) {
|
||||
@@ -163,6 +164,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSingleton(String beanName) {
|
||||
return getSingleton(beanName, true);
|
||||
}
|
||||
@@ -270,16 +272,19 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsSingleton(String beanName) {
|
||||
return (this.singletonObjects.containsKey(beanName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSingletonNames() {
|
||||
synchronized (this.singletonObjects) {
|
||||
return StringUtils.toStringArray(this.registeredSingletons);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSingletonCount() {
|
||||
synchronized (this.singletonObjects) {
|
||||
return this.registeredSingletons.size();
|
||||
|
||||
@@ -203,10 +203,12 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (this.beanPostProcessors != null && !this.beanPostProcessors.isEmpty()) {
|
||||
for (DestructionAwareBeanPostProcessor processor : this.beanPostProcessors) {
|
||||
@@ -221,6 +223,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
try {
|
||||
if (System.getSecurityManager() != null) {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
((DisposableBean) bean).destroy();
|
||||
return null;
|
||||
@@ -258,6 +261,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
try {
|
||||
if (System.getSecurityManager() != null) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Method>() {
|
||||
@Override
|
||||
public Method run() {
|
||||
return findDestroyMethod();
|
||||
}
|
||||
@@ -298,6 +302,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
try {
|
||||
if (System.getSecurityManager() != null) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
ReflectionUtils.makeAccessible(destroyMethod);
|
||||
return null;
|
||||
@@ -305,6 +310,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
});
|
||||
try {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
destroyMethod.invoke(bean, args);
|
||||
return null;
|
||||
|
||||
@@ -56,6 +56,7 @@ public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanReg
|
||||
try {
|
||||
if (System.getSecurityManager() != null) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Class>() {
|
||||
@Override
|
||||
public Class run() {
|
||||
return factoryBean.getObjectType();
|
||||
}
|
||||
@@ -129,6 +130,7 @@ public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanReg
|
||||
AccessControlContext acc = getAccessControlContext();
|
||||
try {
|
||||
object = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
return factory.getObject();
|
||||
}
|
||||
|
||||
@@ -66,10 +66,12 @@ public class GenericBeanDefinition extends AbstractBeanDefinition {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setParentName(String parentName) {
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParentName() {
|
||||
return this.parentName;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public class ManagedList<E> extends ArrayList<E> implements Mergeable, BeanMetad
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
@@ -83,10 +84,12 @@ public class ManagedList<E> extends ArrayList<E> implements Mergeable, BeanMetad
|
||||
this.mergeEnabled = mergeEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMergeEnabled() {
|
||||
return this.mergeEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<E> merge(Object parent) {
|
||||
if (!this.mergeEnabled) {
|
||||
|
||||
@@ -58,6 +58,7 @@ public class ManagedMap<K, V> extends LinkedHashMap<K, V> implements Mergeable,
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
@@ -98,10 +99,12 @@ public class ManagedMap<K, V> extends LinkedHashMap<K, V> implements Mergeable,
|
||||
this.mergeEnabled = mergeEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMergeEnabled() {
|
||||
return this.mergeEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object merge(Object parent) {
|
||||
if (!this.mergeEnabled) {
|
||||
|
||||
@@ -45,6 +45,7 @@ public class ManagedProperties extends Properties implements Mergeable, BeanMeta
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
@@ -57,11 +58,13 @@ public class ManagedProperties extends Properties implements Mergeable, BeanMeta
|
||||
this.mergeEnabled = mergeEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMergeEnabled() {
|
||||
return this.mergeEnabled;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object merge(Object parent) {
|
||||
if (!this.mergeEnabled) {
|
||||
throw new IllegalStateException("Not allowed to merge when the 'mergeEnabled' property is set to 'false'");
|
||||
|
||||
@@ -56,6 +56,7 @@ public class ManagedSet<E> extends LinkedHashSet<E> implements Mergeable, BeanMe
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
@@ -82,10 +83,12 @@ public class ManagedSet<E> extends LinkedHashSet<E> implements Mergeable, BeanMe
|
||||
this.mergeEnabled = mergeEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMergeEnabled() {
|
||||
return this.mergeEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<E> merge(Object parent) {
|
||||
if (!this.mergeEnabled) {
|
||||
|
||||
@@ -83,6 +83,7 @@ public abstract class MethodOverride implements BeanMetadataElement {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -204,6 +204,7 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
|
||||
* @throws BeanDefinitionStoreException in case of loading or parsing errors
|
||||
* @see #loadBeanDefinitions(org.springframework.core.io.Resource, String)
|
||||
*/
|
||||
@Override
|
||||
public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
|
||||
return loadBeanDefinitions(new EncodedResource(resource), null);
|
||||
}
|
||||
|
||||
@@ -241,10 +241,12 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getParentName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentName(String parentName) {
|
||||
if (parentName != null) {
|
||||
throw new IllegalArgumentException("Root bean cannot be changed into a child bean with parent reference");
|
||||
|
||||
@@ -37,10 +37,12 @@ public class SimpleAutowireCandidateResolver implements AutowireCandidateResolve
|
||||
* <p>To be considered a candidate the bean's <em>autowire-candidate</em>
|
||||
* attribute must not have been set to 'false'.
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) {
|
||||
return bdHolder.getBeanDefinition().isAutowireCandidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSuggestedValue(DependencyDescriptor descriptor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public class SimpleBeanDefinitionRegistry extends SimpleAliasRegistry implements
|
||||
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>(64);
|
||||
|
||||
|
||||
@Override
|
||||
public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition)
|
||||
throws BeanDefinitionStoreException {
|
||||
|
||||
@@ -48,12 +49,14 @@ public class SimpleBeanDefinitionRegistry extends SimpleAliasRegistry implements
|
||||
this.beanDefinitionMap.put(beanName, beanDefinition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBeanDefinition(String beanName) throws NoSuchBeanDefinitionException {
|
||||
if (this.beanDefinitionMap.remove(beanName) == null) {
|
||||
throw new NoSuchBeanDefinitionException(beanName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefinitionException {
|
||||
BeanDefinition bd = this.beanDefinitionMap.get(beanName);
|
||||
if (bd == null) {
|
||||
@@ -62,18 +65,22 @@ public class SimpleBeanDefinitionRegistry extends SimpleAliasRegistry implements
|
||||
return bd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsBeanDefinition(String beanName) {
|
||||
return this.beanDefinitionMap.containsKey(beanName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanDefinitionNames() {
|
||||
return StringUtils.toStringArray(this.beanDefinitionMap.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBeanDefinitionCount() {
|
||||
return this.beanDefinitionMap.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBeanNameInUse(String beanName) {
|
||||
return isAlias(beanName) || containsBeanDefinition(beanName);
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object instantiate(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner) {
|
||||
// Don't override the class with CGLIB if no overrides.
|
||||
if (beanDefinition.getMethodOverrides().isEmpty()) {
|
||||
@@ -69,6 +70,7 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
|
||||
try {
|
||||
if (System.getSecurityManager() != null) {
|
||||
constructorToUse = AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor>() {
|
||||
@Override
|
||||
public Constructor run() throws Exception {
|
||||
return clazz.getDeclaredConstructor((Class[]) null);
|
||||
}
|
||||
@@ -105,6 +107,7 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
|
||||
"Method Injection not supported in SimpleInstantiationStrategy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiate(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner,
|
||||
final Constructor<?> ctor, Object[] args) {
|
||||
|
||||
@@ -112,6 +115,7 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
|
||||
if (System.getSecurityManager() != null) {
|
||||
// use own privileged to change accessibility (when security is on)
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
ReflectionUtils.makeAccessible(ctor);
|
||||
return null;
|
||||
@@ -138,12 +142,14 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
|
||||
"Method Injection not supported in SimpleInstantiationStrategy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiate(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner,
|
||||
Object factoryBean, final Method factoryMethod, Object[] args) {
|
||||
|
||||
try {
|
||||
if (System.getSecurityManager() != null) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
ReflectionUtils.makeAccessible(factoryMethod);
|
||||
return null;
|
||||
|
||||
@@ -51,6 +51,7 @@ public class SimpleSecurityContextProvider implements SecurityContextProvider {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AccessControlContext getAccessControlContext() {
|
||||
return (this.acc != null ? acc : AccessController.getContext());
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
// Implementation of BeanFactory interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Object getBean(String name) throws BeansException {
|
||||
String beanName = BeanFactoryUtils.transformedBeanName(name);
|
||||
Object bean = this.beans.get(beanName);
|
||||
@@ -103,6 +104,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getBean(String name, Class<T> requiredType) throws BeansException {
|
||||
Object bean = getBean(name);
|
||||
@@ -112,6 +114,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
return (T) bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getBean(Class<T> requiredType) throws BeansException {
|
||||
String[] beanNames = getBeanNamesForType(requiredType);
|
||||
if (beanNames.length == 1) {
|
||||
@@ -122,6 +125,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean(String name, Object... args) throws BeansException {
|
||||
if (args != null) {
|
||||
throw new UnsupportedOperationException(
|
||||
@@ -130,16 +134,19 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
return getBean(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsBean(String name) {
|
||||
return this.beans.containsKey(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
|
||||
Object bean = getBean(name);
|
||||
// In case of FactoryBean, return singleton status of created object.
|
||||
return (bean instanceof FactoryBean && ((FactoryBean) bean).isSingleton());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrototype(String name) throws NoSuchBeanDefinitionException {
|
||||
Object bean = getBean(name);
|
||||
// In case of FactoryBean, return prototype status of created object.
|
||||
@@ -147,11 +154,13 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
(bean instanceof FactoryBean && !((FactoryBean) bean).isSingleton()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
|
||||
Class type = getType(name);
|
||||
return (targetType == null || (type != null && targetType.isAssignableFrom(type)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType(String name) throws NoSuchBeanDefinitionException {
|
||||
String beanName = BeanFactoryUtils.transformedBeanName(name);
|
||||
|
||||
@@ -168,6 +177,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
return bean.getClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAliases(String name) {
|
||||
return new String[0];
|
||||
}
|
||||
@@ -177,22 +187,27 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
// Implementation of ListableBeanFactory interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean containsBeanDefinition(String name) {
|
||||
return this.beans.containsKey(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBeanDefinitionCount() {
|
||||
return this.beans.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanDefinitionNames() {
|
||||
return StringUtils.toStringArray(this.beans.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(Class type) {
|
||||
return getBeanNamesForType(type, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(Class type, boolean includeNonSingletons, boolean includeFactoryBeans) {
|
||||
boolean isFactoryType = (type != null && FactoryBean.class.isAssignableFrom(type));
|
||||
List<String> matches = new ArrayList<String>();
|
||||
@@ -215,10 +230,12 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
return StringUtils.toStringArray(matches);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException {
|
||||
return getBeansOfType(type, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean includeFactoryBeans)
|
||||
throws BeansException {
|
||||
@@ -255,6 +272,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
return matches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType)
|
||||
throws BeansException {
|
||||
|
||||
@@ -267,6 +285,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) {
|
||||
return AnnotationUtils.findAnnotation(getType(beanName), annotationType);
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ public class BeanConfigurerSupport implements BeanFactoryAware, InitializingBean
|
||||
/**
|
||||
* Set the {@link BeanFactory} in which this aspect must configure beans.
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
if (!(beanFactory instanceof ConfigurableListableBeanFactory)) {
|
||||
throw new IllegalArgumentException(
|
||||
@@ -96,6 +97,7 @@ public class BeanConfigurerSupport implements BeanFactoryAware, InitializingBean
|
||||
/**
|
||||
* Check that a {@link BeanFactory} has been set.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.beanFactory, "BeanFactory must be set");
|
||||
}
|
||||
@@ -104,6 +106,7 @@ public class BeanConfigurerSupport implements BeanFactoryAware, InitializingBean
|
||||
* Release references to the {@link BeanFactory} and
|
||||
* {@link BeanWiringInfoResolver} when the container is destroyed.
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
this.beanFactory = null;
|
||||
this.beanWiringInfoResolver = null;
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.ClassUtils;
|
||||
*/
|
||||
public class ClassNameBeanWiringInfoResolver implements BeanWiringInfoResolver {
|
||||
|
||||
@Override
|
||||
public BeanWiringInfo resolveWiringInfo(Object beanInstance) {
|
||||
Assert.notNull(beanInstance, "Bean instance must not be null");
|
||||
return new BeanWiringInfo(ClassUtils.getUserClass(beanInstance).getName(), true);
|
||||
|
||||
@@ -55,6 +55,7 @@ public abstract class AbstractBeanDefinitionParser implements BeanDefinitionPars
|
||||
/** Constant for the name attribute */
|
||||
public static final String NAME_ATTRIBUTE = "name";
|
||||
|
||||
@Override
|
||||
public final BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
AbstractBeanDefinition definition = parseInternal(element, parserContext);
|
||||
if (definition != null && !parserContext.isNested()) {
|
||||
|
||||
@@ -50,6 +50,7 @@ public class BeansDtdResolver implements EntityResolver {
|
||||
private static final Log logger = LogFactory.getLog(BeansDtdResolver.class);
|
||||
|
||||
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) throws IOException {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Trying to resolve XML entity with public ID [" + publicId +
|
||||
|
||||
@@ -91,6 +91,7 @@ public class DefaultBeanDefinitionDocumentReader implements BeanDefinitionDocume
|
||||
* {@code <beans/>} element with a {@code profile} attribute present.
|
||||
* @see #doRegisterBeanDefinitions
|
||||
*/
|
||||
@Override
|
||||
public void setEnvironment(Environment environment) {
|
||||
this.environment = environment;
|
||||
}
|
||||
@@ -102,6 +103,7 @@ public class DefaultBeanDefinitionDocumentReader implements BeanDefinitionDocume
|
||||
* <p>Opens a DOM Document; then initializes the default settings
|
||||
* specified at the {@code <beans/>} level; then parses the contained bean definitions.
|
||||
*/
|
||||
@Override
|
||||
public void registerBeanDefinitions(Document doc, XmlReaderContext readerContext) {
|
||||
this.readerContext = readerContext;
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ public class DefaultDocumentLoader implements DocumentLoader {
|
||||
* Load the {@link Document} at the supplied {@link InputSource} using the standard JAXP-configured
|
||||
* XML parser.
|
||||
*/
|
||||
@Override
|
||||
public Document loadDocument(InputSource inputSource, EntityResolver entityResolver,
|
||||
ErrorHandler errorHandler, int validationMode, boolean namespaceAware) throws Exception {
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ public class DefaultNamespaceHandlerResolver implements NamespaceHandlerResolver
|
||||
* @param namespaceUri the relevant namespace URI
|
||||
* @return the located {@link NamespaceHandler}, or {@code null} if none found
|
||||
*/
|
||||
@Override
|
||||
public NamespaceHandler resolve(String namespaceUri) {
|
||||
Map<String, Object> handlerMappings = getHandlerMappings();
|
||||
Object handlerOrClassName = handlerMappings.get(namespaceUri);
|
||||
|
||||
@@ -76,6 +76,7 @@ public class DelegatingEntityResolver implements EntityResolver {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
|
||||
if (systemId != null) {
|
||||
if (systemId.endsWith(DTD_SUFFIX)) {
|
||||
|
||||
@@ -153,6 +153,7 @@ public class DocumentDefaultsDefinition implements DefaultsDefinition {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler {
|
||||
* Parses the supplied {@link Element} by delegating to the {@link BeanDefinitionParser} that is
|
||||
* registered for that {@link Element}.
|
||||
*/
|
||||
@Override
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
return findParserForElement(element, parserContext).parse(element, parserContext);
|
||||
}
|
||||
@@ -91,6 +92,7 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler {
|
||||
* Decorates the supplied {@link Node} by delegating to the {@link BeanDefinitionDecorator} that
|
||||
* is registered to handle that {@link Node}.
|
||||
*/
|
||||
@Override
|
||||
public BeanDefinitionHolder decorate(
|
||||
Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ public class PluggableSchemaResolver implements EntityResolver {
|
||||
this.schemaMappingsLocation = schemaMappingsLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) throws IOException {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Trying to resolve XML entity with public id [" + publicId +
|
||||
|
||||
@@ -59,15 +59,18 @@ public class SimpleConstructorNamespaceHandler implements NamespaceHandler {
|
||||
private static final String REF_SUFFIX = "-ref";
|
||||
private static final String DELIMITER_PREFIX = "_";
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Class [" + getClass().getName() + "] does not support custom elements.", element);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
|
||||
if (node instanceof Attr) {
|
||||
Attr attr = (Attr) node;
|
||||
|
||||
@@ -52,15 +52,18 @@ public class SimplePropertyNamespaceHandler implements NamespaceHandler {
|
||||
private static final String REF_SUFFIX = "-ref";
|
||||
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Class [" + getClass().getName() + "] does not support custom elements.", element);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
|
||||
if (node instanceof Attr) {
|
||||
Attr attr = (Attr) node;
|
||||
|
||||
@@ -45,6 +45,7 @@ public class UtilNamespaceHandler extends NamespaceHandlerSupport {
|
||||
private static final String SCOPE_ATTRIBUTE = "scope";
|
||||
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
registerBeanDefinitionParser("constant", new ConstantBeanDefinitionParser());
|
||||
registerBeanDefinitionParser("property-path", new PropertyPathBeanDefinitionParser());
|
||||
|
||||
@@ -298,6 +298,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
|
||||
* @return the number of bean definitions found
|
||||
* @throws BeanDefinitionStoreException in case of loading or parsing errors
|
||||
*/
|
||||
@Override
|
||||
public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
|
||||
return loadBeanDefinitions(new EncodedResource(resource));
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@ public class MutableSortDefinition implements SortDefinition, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty() {
|
||||
return this.property;
|
||||
}
|
||||
@@ -115,6 +116,7 @@ public class MutableSortDefinition implements SortDefinition, Serializable {
|
||||
this.ignoreCase = ignoreCase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIgnoreCase() {
|
||||
return this.ignoreCase;
|
||||
}
|
||||
@@ -126,6 +128,7 @@ public class MutableSortDefinition implements SortDefinition, Serializable {
|
||||
this.ascending = ascending;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAscending() {
|
||||
return this.ascending;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ public class PropertyComparator implements Comparator {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
Object v1 = getPropertyValue(o1);
|
||||
Object v2 = getPropertyValue(o2);
|
||||
|
||||
@@ -106,6 +106,7 @@ public class ResourceEditorRegistrar implements PropertyEditorRegistrar {
|
||||
* @see org.springframework.beans.propertyeditors.ClassArrayEditor
|
||||
* @see org.springframework.core.io.support.ResourceArrayPropertyEditor
|
||||
*/
|
||||
@Override
|
||||
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
||||
ResourceEditor baseEditor = new ResourceEditor(this.resourceLoader, this.propertyResolver);
|
||||
doRegisterEditor(registry, Resource.class, baseEditor);
|
||||
|
||||
Reference in New Issue
Block a user