[ 
https://issues.apache.org/jira/browse/WICKET-2887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12871336#action_12871336
 ] 

Martin Grigorov edited comment on WICKET-2887 at 5/25/10 5:37 PM:
------------------------------------------------------------------

I have a question about the design of 
org.apache.wicket.protocol.http.IWebApplicationFactory: 
Is it needed to use addComponentInstantiationListener(...) in MyApp#init() if I 
use an implementation of org.apache.wicket.protocol.http.IWebApplicationFactory 
?

org.apache.wicket.guice.GuiceWebApplicationFactory installs 
GuiceComponentInjector automatically. 
org.apache.wicket.spring.SpringWebApplicationFactory don't do that and the user 
still has to install the listener explicitly.
I believe Guice approach is the better one.


      was (Author: martin-g):
    I have a question about the design of 
org.apache.wicket.protocol.http.IWebApplicationFactory: 
Is it needed to use addComponentInstantiationListener(...) in MyApp#init() if I 
use an implementation of org.apache.wicket.protocol.http.IWebApplicationFactory 
?

org.apache.wicket.guice.GuiceWebApplicationFactory installs 
GuiceComponentInjector automatically. 
org.apache.wicket.spring.SpringWebApplicationFactory don't do that and the user 
still has to install the listener explicitly.
I believe Guice approach is the better one.

A fix could be to move "Application.set(webApplication);" in 
WicketFilter#init(FilterConfig) few lines above to be just before 
"webApplication = webApplicationFactory.createApplication(this);"
  
> Bootstraping wicket with GuiceWebApplicationFactory fails with exception
> ------------------------------------------------------------------------
>
>                 Key: WICKET-2887
>                 URL: https://issues.apache.org/jira/browse/WICKET-2887
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-guice
>    Affects Versions: 1.4.8, 1.4.9
>            Reporter: Zilvinas Kybartas
>         Attachments: WICKET-2887-1.4.9.patch
>
>
> There seems to be some sort of chicken-egg problem:
> org.apache.wicket.WicketRuntimeException: There is no application attached to 
> current thread main
>       at org.apache.wicket.Application.get(Application.java:179) 
> [wicket-1.4.9.jar:1.4.9]
>       at 
> org.apache.wicket.injection.web.InjectorHolder.setInjector(InjectorHolder.java:88)
>  [wicket-ioc-1.4.9.jar:1.4.9]
>       at 
> org.apache.wicket.guice.GuiceComponentInjector.<init>(GuiceComponentInjector.java:102)
>  [wicket-guice-1.4.9.jar:1.4.9]
>       at 
> org.apache.wicket.guice.GuiceWebApplicationFactory.createApplication(GuiceWebApplicationFactory.java:177)
>  [wicket-guice-1.4.9.jar:1.4.9]
>       at 
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:701) 
> [wicket-1.4.9.jar:1.4.9]
> After some digging i found that it is actually a regression made by this 
> issue fix - WICKET-2761.
> If I rollback wicket-guice to 1.4.7, everything starts to work just fine.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to