Class SpringComponentInjector

java.lang.Object
org.apache.wicket.injection.Injector
org.apache.wicket.spring.injection.annot.SpringComponentInjector
All Implemented Interfaces:
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.

Author:
Igor Vaynberg (ivaynberg), Justin Lee
  • Constructor Details

    • SpringComponentInjector

      Constructor used when spring application context is declared in the spring standard way and can be located through WebApplicationContextUtils.getRequiredWebApplicationContext(jakarta.servlet.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 Details