public class SpringReferenceSupporter extends AbstractSpringReferenceSupporter
Used by SpringReference and AbstractSpringDependencies to do the actual spring
bean lookups. This must be registered in the init() method of your wicket Application or
WebApplication otherwise SpringReference and AbstractSpringDependencies
will not work.
Example:
public class App extends WebApplication {
@Override
public Class extends Page> getHomePage() {
return HomePage.class;
}
@Override
protected void init() {
super.init();
getMarkupSettings().setDefaultMarkupEncoding(CharEncoding.UTF_8);
SpringReferenceSupporter.register(this); // <--
}
}
| Constructor and Description |
|---|
SpringReferenceSupporter(org.springframework.context.ApplicationContext applicationContext)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected static SpringReferenceSupporter |
get() |
protected org.springframework.context.ApplicationContext |
getApplicationContext() |
static void |
register(org.apache.wicket.Application application,
SpringReferenceSupporter supporter)
Registers the passed in supporter with the wicket application.
|
static void |
register(org.apache.wicket.protocol.http.WebApplication application)
Creates and registers an instance of this class with the wicket web application.
|
clearCache, findAndSetInstance, findBeanName, getBeanDefinitionpublic SpringReferenceSupporter(org.springframework.context.ApplicationContext applicationContext)
applicationContext - where the spring bean will be searched for, not nullpublic static void register(org.apache.wicket.protocol.http.WebApplication application)
WebApplicationContextUtils.getRequiredWebApplicationContext(ServletContext) to get
spring web application context. If more fine grained registration is needed use
register(Application, SpringReferenceSupporter). If you want to use
SpringReference you have to use one of the register methods in your wicket
applications init().application - wicket web application, not nullpublic static void register(org.apache.wicket.Application application,
SpringReferenceSupporter supporter)
register(WebApplication).application - wicket application, not nullsupporter - spring reference supporter. Null value means removal.protected static SpringReferenceSupporter get()
protected org.springframework.context.ApplicationContext getApplicationContext()
getApplicationContext in class AbstractSpringReferenceSupporterCopyright © 2015. All rights reserved.