Provide Access to Spring from Application
When developing with Apache Wicket, there are times when you won't be able to use wicket-spring to access your bean implementations. Here is a simple example that you can add to your Wicket Application class to make accessing the context easier
protected void init() {
...
ServletContext servletContext = super.getServletContext();
applicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
...
}
private ApplicationContext applicationContext;
public Object getBean(String name) {
if (name == null) return null;
return applicationContext.getBean(name);
}