spring wiki page shows how to set it up...

-igor


On Fri, Mar 7, 2008 at 3:11 AM, Jörn Zaefferer
<[EMAIL PROTECTED]> wrote:
> Hi,
>
>  my wicket applicatin uses the SpringComponentInjector and @SpringBean
>  annotations, which works great at runtime where the application
>  context is present.
>
>  I'd like to use WicketTester for JUnit tests:
>
>  tester = new WicketTester(new MyApplication());
>  In MyApplication#init, the component injector is created:
>  addComponentInstantiationListener(new SpringComponentInjector(this));
>  That constructor loads the ApplicationContext via
>  
> WebApplicationContextUtils.getRequiredWebApplicationContext(webapp.getServletContext()
>
>  That is the part which fails in my test, because there is no
>  ApplicationContext stored in the servlet context. How can I fix that?
>
>  My attempts so far:
>  The description here doesn't help:
>  http://cwiki.apache.org/WICKET/spring.html#Spring-UnitTestingtheProxyApproach
>  The injector is already configured at that point.
>
>  The alternative would be to put the application context into the
>  ServletContext, so that WebApplicationContextUtils can find it. I've
>  found no way to access MockWebApplication.context to set it manually,
>  though I was able to set it by overwriting newServletContext. Though
>  .setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
>  context); where context is of type AnnotApplicationContextMock yields
>  an IllegalStateException, because AnnotApplicationContextMock doesn't
>  implement WebApplicationContext.
>
>  Thanks
>  Jörn
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to