001/* 002 * Copyright 2002-2016 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.beans.factory.config; 018 019import java.beans.PropertyDescriptor; 020import java.lang.reflect.Constructor; 021 022import org.springframework.beans.BeansException; 023import org.springframework.beans.PropertyValues; 024 025/** 026 * Adapter that implements all methods on {@link SmartInstantiationAwareBeanPostProcessor} 027 * as no-ops, which will not change normal processing of each bean instantiated 028 * by the container. Subclasses may override merely those methods that they are 029 * actually interested in. 030 * 031 * <p>Note that this base class is only recommendable if you actually require 032 * {@link InstantiationAwareBeanPostProcessor} functionality. If all you need 033 * is plain {@link BeanPostProcessor} functionality, prefer a straight 034 * implementation of that (simpler) interface. 035 * 036 * @author Rod Johnson 037 * @author Juergen Hoeller 038 * @since 2.0 039 */ 040public abstract class InstantiationAwareBeanPostProcessorAdapter implements SmartInstantiationAwareBeanPostProcessor { 041 042 @Override 043 public Class<?> predictBeanType(Class<?> beanClass, String beanName) { 044 return null; 045 } 046 047 @Override 048 public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, String beanName) throws BeansException { 049 return null; 050 } 051 052 @Override 053 public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException { 054 return bean; 055 } 056 057 @Override 058 public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException { 059 return null; 060 } 061 062 @Override 063 public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException { 064 return true; 065 } 066 067 @Override 068 public PropertyValues postProcessPropertyValues( 069 PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException { 070 071 return pvs; 072 } 073 074 @Override 075 public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { 076 return bean; 077 } 078 079 @Override 080 public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { 081 return bean; 082 } 083 084}