Apache%20Wicket%20Interview%20Questions%20and%20Answers
Question: How to integrate apache-wicket with Spring?Answer:Override Wicket application init() method with this “addComponentInstantiationListener(new SpringComponentInjector(this));“. File : Wicket application class package com.withoutbook; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.spring.injection.annot.SpringComponentInjector; import com.withoutbook.user.SimplePage; public class WicketApplication extends WebApplication { @Override public Class<SimplePage> getHomePage() { return SimplePage.class; // return default page } @Override protected void init() { super.init(); addComponentInstantiationListener(new SpringComponentInjector(this)); } } Now, you can inject Spring bean into Wicket component via @SpringBean. |
Is it helpful?
Yes
No
Most helpful rated by users:
- What is Wicket Framework?
- What are Wicket Models?
- What is Base class for HTML pages?
- What are the Ways to create a page in wicket?
- How to integrate apache-wicket with Spring?