Hello, all -

Guice/Wicket integration is excellent, but doesn't seem to work properly
when I use @Inject-ed services on my *page* classes. It only seems to work
when I inject services on components of my pages. I get
WicketNotSerializableExceptions for services that I inject on my page class
instances.

So, if this is my page class:

====

public class MyPage extends WebPage {

    @Inject
   private MyDao myDao; // causes WicketNotSerializableException

   public MyPage() {
       add(new MyPanel() {
           @Inject
           private MyDao myDao; // works fine and dandy
           ...
       }
   }
}

====

I get:

====

org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
Unable to serialize class:
com.mycompany.dao.MyDao$$EnhancerByGuice$$3e6e9f94
Field hierarchy is:
  2 [class=com.mycompany.pages.MyPage, path=2]
    private com.mycompany.dao.MyDao
com.mycompany.pages.MyPage.myDao[class=com.mycompany.dao.MyDao$$EnhancerByGuice$$3e6e9f94]
<----- field that is not serializable
    at
org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:342)
    at
org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:610)
...
====

Has anyone else noticed this?

Reply via email to