1 /* 2 * Copyright 2002-2005 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.springframework.beans.factory.config; 18 19 import org.springframework.beans.BeansException; 20 21 /** 22 * Subinterface of BeanPostProcessor that adds a before-destruction callback. 23 * 24 * <p>The typical usage will be to invoke custom destruction callbacks on 25 * specific bean types, matching corresponding initialization callbacks. 26 * 27 * @author Juergen Hoeller 28 * @since 1.0.1 29 * @see org.springframework.web.struts.ActionServletAwareProcessor 30 */ 31 public interface DestructionAwareBeanPostProcessor extends BeanPostProcessor { 32 33 /** 34 * Apply this BeanPostProcessor to the given bean instance before 35 * its destruction. Can invoke custom destruction callbacks. 36 * <p>Like DisposableBean's <code>destroy</code> and a custom destroy method, 37 * this callback just applies to singleton beans in the factory (including 38 * inner beans). 39 * @param bean the bean instance to be destroyed 40 * @param beanName the name of the bean 41 * @throws org.springframework.beans.BeansException in case of errors 42 * @see org.springframework.beans.factory.DisposableBean 43 * @see org.springframework.beans.factory.support.AbstractBeanDefinition#setDestroyMethodName 44 */ 45 void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException; 46 47 } 48