Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added change for 1.5

...

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);\]_

...