This posts is about the vision that my colleague Daniel Fernández and me have
about how should be the integration between Wicket and Spring, using the new
annotation functionalities provided by Spring 2.5. The @SpringBean approach
is very useful, but its magic about a transient attribute that is not
transient make us fell uncomfortable.

Four main steps are needed in this approach:

1) Change applicationClassname web.xml parameter to:

<init-param>
            <param-name>applicationFactoryClassName</param-name>
            <param-value>
                org.apache.wicket.spring.SpringWebApplicationFactory
            </param-value>
</init-param>

2) Declare the application class as a Spring bean (Spring 2.5 way)

@Component
public class MyApplication extends WebApplication 

3) Declare into the application class the services with the correct Spring
2.5 annotations

@Autowired
private AaaService aaaService;

4) Add getters for the services
public AaaService getAaaService(){
    return this.aaaService;
}

For convenience, you can add a static get() method to retrieve the casted
application class

public static MyApplication get() {
        return (MyApplication) Application.get();
}

So you can retrieve the service from any page with a simple
MyApplication.get().getAaaService()




As the applications class is not serializable, there are no need to make
transient magic.

What do you think about this approach?




-- 
View this message in context: 
http://www.nabble.com/Spring-2.5-and-Wicket%2C-our-vision-about-integration-tp16930960p16930960.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