001/* 002 * Copyright 2002-2012 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; 018 019import org.springframework.beans.FatalBeanException; 020 021/** 022 * Exception to be thrown from a FactoryBean's {@code getObject()} method 023 * if the bean is not fully initialized yet, for example because it is involved 024 * in a circular reference. 025 * 026 * <p>Note: A circular reference with a FactoryBean cannot be solved by eagerly 027 * caching singleton instances like with normal beans. The reason is that 028 * <i>every</i> FactoryBean needs to be fully initialized before it can 029 * return the created bean, while only <i>specific</i> normal beans need 030 * to be initialized - that is, if a collaborating bean actually invokes 031 * them on initialization instead of just storing the reference. 032 * 033 * @author Juergen Hoeller 034 * @since 30.10.2003 035 * @see FactoryBean#getObject() 036 */ 037@SuppressWarnings("serial") 038public class FactoryBeanNotInitializedException extends FatalBeanException { 039 040 /** 041 * Create a new FactoryBeanNotInitializedException with the default message. 042 */ 043 public FactoryBeanNotInitializedException() { 044 super("FactoryBean is not fully initialized yet"); 045 } 046 047 /** 048 * Create a new FactoryBeanNotInitializedException with the given message. 049 * @param msg the detail message 050 */ 051 public FactoryBeanNotInitializedException(String msg) { 052 super(msg); 053 } 054 055}