1 /* 2 * Copyright 2002-2006 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; 18 19 /** 20 * Callback that allows a bean to be aware of the bean 21 * {@link ClassLoader class loader}; that is, the class loader used by the 22 * present bean factory to load bean classes. 23 * 24 * <p>This is mainly intended to be implemented by framework classes which 25 * have to pick up application classes by name despite themselves potentially 26 * being loaded from a shared class loader. 27 * 28 * <p>For a list of all bean lifecycle methods, see the 29 * {@link BeanFactory BeanFactory javadocs}. 30 * 31 * @author Juergen Hoeller 32 * @since 2.0 33 * @see BeanNameAware 34 * @see BeanFactoryAware 35 * @see InitializingBean 36 */ 37 public interface BeanClassLoaderAware { 38 39 /** 40 * Callback that supplies the bean {@link ClassLoader class loader} to 41 * a bean instance. 42 * <p>Invoked <i>after</i> the population of normal bean properties but 43 * <i>before</i> an initialization callback such as 44 * {@link org.springframework.beans.factory.InitializingBean InitializingBean's} 45 * {@link org.springframework.beans.factory.InitializingBean#afterPropertiesSet()} 46 * method or a custom init-method. 47 * @param classLoader the owning class loader; may be <code>null</code> in 48 * which case a default <code>ClassLoader</code> must be used, for example 49 * the <code>ClassLoader</code> obtained via 50 * {@link org.springframework.util.ClassUtils#getDefaultClassLoader()} 51 */ 52 void setBeanClassLoader(ClassLoader classLoader); 53 54 } 55