Hi Everyone,

I'm just getting started with wicket and am learning by playing around with
building an ecommerce application on top of wicket, spring and hibernate.
I've been (Ha!) using @SpringBean to inject my spring dependencies and am
very impressed with it.

One thing I'm wondering about is how to use @SpringBean with a pattern in
the 'wicket in action' book. Specifically, when creating a
bookmarkablePageLink with pageparameters this pattern is used:

public class CheeseDetailsPage extends WebPage {
    // bookmarkable constructor
    public CheeseDetailsPage(PageParameters parameters) {   #1
        this(getCheese(parameters));
    }
    // non-bookmarkable constructor
    public CheeseDetailsPage(Cheese cheese) {         #2
        // do cheesy stuff with the cheese
    }
    /** Retrieves a cheese object based on the ‘name’ parameter. */
    public static Cheese getCheese(PageParameters parameters) { #3
        String name = parameters.getString("name", "");
        if("".equals(name)) return null;
        CheeseDao dao = ...;
        return dao.getCheeseByName(name);
    }
}

I like this pattern but i'm having a problem with injecting my dependencies.
The getCheese() method is static, which means that the CheeseDao would have
to be static. I haven't delved into the code of the @SpringBean proxy or the
wicket serialization code (I have read the wiki on @SpringBean) and I don't
have an amazing understanding of proxies so maybe i'm just being obtuse but
heres my question.

Is there any reason not to make the DAO static?

Cheers in advance

-- 
View this message in context: 
http://www.nabble.com/%40SpringBean-with-page-creation-patterns-tp20845794p20845794.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to