org.apache.wicket.spring.injection.annot
Class SpringComponentInjector

java.lang.Object
  extended by org.apache.wicket.injection.Injector
      extended by org.apache.wicket.spring.injection.annot.SpringComponentInjector
All Implemented Interfaces:
IComponentInstantiationListener

public class SpringComponentInjector
extends Injector
implements IComponentInstantiationListener

IComponentInstantiationListener that injects component properties annotated with SpringBean annotations. To install in yourapplication.init() call addComponentInstantiationListener(new SpringComponentInjector(this)); Non-wicket components such as Session, Model, and any other pojo can be injected by calling Injector.get().inject(this) in their constructor.

Author:
Igor Vaynberg (ivaynberg), Justin Lee

Constructor Summary
SpringComponentInjector(WebApplication webapp)
          Constructor used when spring application context is declared in the spring standard way and can be located through WebApplicationContextUtils.getRequiredWebApplicationContext(ServletContext)
SpringComponentInjector(WebApplication webapp, org.springframework.context.ApplicationContext ctx)
          Constructor
SpringComponentInjector(WebApplication webapp, org.springframework.context.ApplicationContext ctx, boolean wrapInProxies)
          Constructor
 
Method Summary
 void inject(java.lang.Object object)
          Injects the specified object.
 void onInstantiation(Component component)
          Called for every component that is instantiated.
 
Methods inherited from class org.apache.wicket.injection.Injector
bind, get, inject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringComponentInjector

public SpringComponentInjector(WebApplication webapp)
Constructor used when spring application context is declared in the spring standard way and can be located through WebApplicationContextUtils.getRequiredWebApplicationContext(ServletContext)

Parameters:
webapp - wicket web application

SpringComponentInjector

public SpringComponentInjector(WebApplication webapp,
                               org.springframework.context.ApplicationContext ctx)
Constructor

Parameters:
webapp - wicket web application
ctx - spring's application context

SpringComponentInjector

public SpringComponentInjector(WebApplication webapp,
                               org.springframework.context.ApplicationContext ctx,
                               boolean wrapInProxies)
Constructor

Parameters:
webapp - wicket web application
ctx - spring's application context
wrapInProxies - whether or not wicket should wrap dependencies with specialized proxies that can be safely serialized. in most cases this should be set to true.
Method Detail

inject

public void inject(java.lang.Object object)
Injects the specified object. This method is usually implemented by delegating to Injector.inject(Object, IFieldValueFactory) with some IFieldValueFactory

Specified by:
inject in class Injector
See Also:
Injector.inject(Object, IFieldValueFactory)

onInstantiation

public void onInstantiation(Component component)
Called for every component that is instantiated. This method is called during construction, so do not depend on the construction being completed yet. The id is guaranteed to be set before this call.

Specified by:
onInstantiation in interface IComponentInstantiationListener
Parameters:
component - the component that is being instantiated.


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.