/*
 * $Id$
 * $Revision$ $Date$
 * 
 * ==============================================================================
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package wicket.injection;

import wicket.Component;
import wicket.IComponentInstantiationListener;
import wicket.injection.web.InjectorHolder;

/**
 * Enables your application to do Spring dependency injection. To use, register
 * the injector as a {@link wicket.IComponentInstantiationListener} like this:
 * 
 * <pre>
 *    ... (in your application's constructor or init method)
 *    add(new ComponentInjector());
 *    ...
 * </pre>
 * 
 * @see wicket.IComponentInstantiationListener
 * @see wicket.Application#add(IComponentInstantiationListener)
 * @author Eelco Hillenius
 */
public class ComponentInjector implements IComponentInstantiationListener
{

	/**
	 * Construct.
	 */
	public ComponentInjector()
	{
	}

	/**
	 * @see wicket.IComponentInstantiationListener#onInstantiation(wicket.Component)
	 */
	public void onInstantiation(Component component)
	{
		getInjector().inject(component);
	}

	private ConfigurableInjector getInjector()
	{
		ConfigurableInjector injector = InjectorHolder.getInjector();
		if (injector == null)
		{
			throw new RuntimeException("injector not set in InjectorHolder");
		}
		return injector;
	}
}

@@ -726,32 +726,44 @@
 ;%0Aimport wicket.
+application.
 IComponentInstan
@@ -935,32 +935,44 @@
 a %7B@link wicket.
+application.
 IComponentInstan
@@ -987,16 +987,19 @@
 istener%7D
+%0A *
  like th
@@ -1017,16 +1017,18 @@
 %3Cpre%3E%0A *
+  
     ... 
@@ -1084,16 +1084,18 @@
 )%0A *    
+  
 add(new 
@@ -1118,16 +1118,18 @@
 r());%0A *
+  
     ...%0A
@@ -1149,32 +1149,44 @@
 %0A * @see wicket.
+application.
 IComponentInstan
@@ -1454,16 +1454,28 @@
  wicket.
+application.
 ICompone

fix for move of component instantiation listener