THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
class MyApplication extends WebApplication { public void init() { super.init(); addComponentInstantiationListener(new SpringComponentInjector(this)); } } class EditContact extends WebPage { @SpringBean private ContactDao dao; @SpringBean(name="userDao") private UserDao userDao; public EditContact(long userId) { ... } } |
With Wicket >1.5 it is:
Code Block |
---|
class MyApplication extends WebApplication {
public void init() {
super.init();
getComponentInstantiationListeners().add(new SpringComponentInjector(this));
}
}
|
Wiki Markup |
---|
Here the page (or indeed anything derived from a Wicket {{Component}}) will have its dependencies injected when created. _\[Constructor/superclass chaining down to the Component(final String id, final IModel model) constructor, where there's a call to getApplication().notifyComponentInstantiationListeners(this);\]_ |
...