The Spring Framework is omnipresent in the world of Java applications. Many developers, teams and organizations make use of Spring for various reasons, such as its persistency support, the AOP features, the MVC framework or the remoting options or the security facilities. Underlying all of these is the bean container, that started it all, with its implementation of the Inversion of Control pattern and the concept of Dependency Injection. The managed beans in JavaServer Faces share many of the same characteristics of the Spring Beans – the configuration in XML (and starting with JSF 2.0 also through annotations), the use of managed properties and injecting one bean in another.

It should then not come as a surprise that it is fairly easy to integrate the Spring Framework with JSF applications. EL expressions can refer to beans – as always. And those beans can either be defined in the faces-config.xml file – or through annotations in Java Classes – or as beans in the Spring way: either in an XML configuration file or through annotations. This article will demonstrate this and show the minimal effort required to integrate Spring into JSF – and thereby also into ADF Faces.

We will then More >