public class SpringComponentInjector extends Injector implements IComponentInstantiationListener, IBehaviorInstantiationListener
IComponentInstantiationListener that injects component and behavior properties
annotated with SpringBean annotations.
To install in yourapplication.init() call
getComponentInstantiationListeners().add(new SpringComponentInjector(this));
Only Wicket Components and Behaviors are automatically injected, other classes
such as Session, Model, and any other POJO can be injected by calling
Injector.get().inject(this) in their constructor.
| Constructor and Description |
|---|
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
|
| Modifier and Type | Method and Description |
|---|---|
void |
inject(Object object) |
void |
onInstantiation(Behavior behavior) |
void |
onInstantiation(Component component) |
static void |
setDefaultContext(WebApplication webapp,
org.springframework.context.ApplicationContext context)
Set the default context for the given webapp.
|
public SpringComponentInjector(WebApplication webapp)
WebApplicationContextUtils.getRequiredWebApplicationContext(ServletContext).webapp - wicket web applicationpublic SpringComponentInjector(WebApplication webapp, org.springframework.context.ApplicationContext ctx)
webapp - wicket web applicationctx - spring's application contextpublic SpringComponentInjector(WebApplication webapp, org.springframework.context.ApplicationContext ctx, boolean wrapInProxies)
webapp - wicket web applicationctx - spring's application contextwrapInProxies - whether or not wicket should wrap dependencies with specialized proxies that can
be safely serialized. in most cases this should be set to true.public void onInstantiation(Component component)
onInstantiation in interface IComponentInstantiationListenerpublic void onInstantiation(Behavior behavior)
onInstantiation in interface IBehaviorInstantiationListenerpublic static void setDefaultContext(WebApplication webapp, org.springframework.context.ApplicationContext context)
webapp - web applicationcontext - context to use as default if non is explicitely specified for the injectorCopyright © 2006–2015 Apache Software Foundation. All rights reserved.