Excuse my bit by bit mailings but I don't want to keep the solution secret. The 
problem with my first try was the missing implicit call to super() within the 
constructor because I used this() instead. The line
InjectorHolder.getInjector().inject(this);
is not necessary when I put the code in a separate method. this works:

public class ArticlePage extends WebPage
{
    @SpringBean
    private ArticleRepository repository;
    private Article article;

    public ArticlePage()
    {
        // no need to use InjectorHolder here
        construct(repository.findByName("index"));
    }

    private void construct(Article article)
    {
        add(new Label("name", new PropertyModel(article, "name")));
        // ...
    }

}

Is there something left to be improved?

Dependency Injection seems to be a bit tricky with wicket. Maybe something for 
the second edition of wicket in action ...

Regards
Christian

-- 
http://www.groovy-forum.de





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to