I have just started using Wicket, and I use Guice for bindings.
However, I got into a situation where private final fields initialized
directly would be null.
Here is the code in my WebApplication constructor:
addComponentInstantiationListener(new IComponentInstantiationListener() {
private final Injector injector = Guice.createInjector(new
Module());
public void onInstantiation(Component component) {
injector.injectMembers(component);
}
});
I prefered this to the wicket guice plugin, that seems to do the above
steps manually by reimplementing Guice logic.
Here is my simple Page body:
private final Label message = new Label("message", "Text");
private Service service;
@Inject
public void init(Service service) {
this.service = service;
add(message);
}
I get a NullPointerException on the add, because message is null.
According to my understanding of Java, I can`t even see how this is
possible. The default constructor should be called regardless, and
thus message would get set.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]