I guess the problem is on the ApplicationContext object. Debug its creation and see if it has all your beans. You can use another implementation for tests, ex: FileSystemXmlApplicationContext
On Mon, Feb 7, 2011 at 11:10 AM, Dmitriy Neretin < dmitriy.nere...@googlemail.com> wrote: > Hello everybody, > > After integration with spring I have following problem: > > if I add following to my CustomSession: > > InjectorHolder.getInjector().inject(this); (because I store some spring > beans in the custom session) > > My WicketTester doesn't work anymore. I get this exception: > "BeanFactory not initialized or already closed - call 'refresh' before > accessing beans via the ApplicationContext" > > What I have done in my Unit Tests: > > @Before > public void setUp() { > MworldWicketApplication wicketWebApp = new MworldWicketApplication() > { > > ApplicationContext ctx = new XmlWebApplicationContext(); > > @Override > public void init() { > addComponentInstantiationListener(new > SpringComponentInjector(this, ctx, true)); > } > }; > > And I don't really understand what to do now :) > > Can somebody help me? > > P. S. The Application works. Affected are only unit tests > -- Pedro Henrique Oliveira dos Santos