3.2. About Spring and Red Hat JBoss Enterprise Application Platform
Spring directly and easily works on Red Hat JBoss Enterprise Application Platform with very little configuration change. The following table lists use cases of JBoss Enterprise Application Platform and Spring integration. These use cases are related to the Sportsclub example that is shipped with Web Framework Kit 2 distribution. The scenarios selected for this example are focused on using the Java EE 6 services, provided by JBoss Enterprise Application Platform, in Spring applications.
Table 3.1. Use cases
| Category | Use case | How does this involve JBoss Enterprise Application Platform |
|---|---|---|
| Persistence | Spring/Hibernate integration | The application uses a Spring-configured Hibernate SessionFactory, using JTA transaction management and JTA-bound sessions. The Hibernate library is the one provided by JBoss Enterprise Application Platform. |
| Spring/JPA integration | The Persistence Unit is deployed by JBoss Enterprise Application Platform and retrieved from JNDI to be injected into Spring beans. PersistenceContext is shared with surrounding EJBs (if any). | |
| Testing | Unit-testing components that have managed infrastructure dependencies | The DataSource and EntityManager are managed by JBoss Enterprise Application Platform and acquired from JNDI by Spring when the application is running. In the case of JBoss Enterprise Application Platform, developers can test their code in isolation using Spring-specific replacements that simulate the JBoss Enterprise Application Platform environment. |
| Business Logic | Spring-based service beans | The business services are Spring-managed and wrapped into transactions managed by Spring's interceptors. The TransactionManager in use is the JTATransactionManager using Transactions provided in JBoss Enterprise Application Platform. |
| EJBs injected with Spring Beans | The application uses JBoss-deployed EJBs which are injected with Spring beans acquired from an application context bootstrapped by the Spring Deployer. Transactions are managed by EJBs. | |
| User Interface | JSF/RichFaces and Spring integration | The application uses JSF support and RichFaces components provided by JBoss Enterprise Application Platform. The business services and UI-backing instances are Spring beans. |
| Spring MVC and EJB integration | The application uses Spring MVC and the business logic is implemented using JBoss-deployed EJBs, which are injected into the Spring controllers. | |
| Conversation-oriented web application | The application uses Spring Web Flow for defining a conversational process for creating a reservation. | |
| JMS/JCA integration | JMS/Spring integration using JCA | The application uses Spring-configured message listeners for processing JMS messages from destinations managed by JBoss Enterprise Application Platform and Spring /JCA integration for receiving messages. |
| JMX | Spring beans are exposed as JMX beans | The JBoss Enterprise Application Platform MBean Server is used for registering the Spring-exported JMX beans. Consequently, the Spring beans can be managed from a management console. |
| Web Services | JAX-WS defined web-services are injected with Spring beans | The application uses JBoss Enterprise Application Platforms' support for JAX-WS through JBoss WS, but also Spring to define the underlying business logic, which is injected into the JBoss WS-deployed services. |
| A Spring Web Services-based variant of the JAX-WS example | The application implements a web service based on Spring Web Services. | |
| Security | Application-server pre-authentication | The application uses Spring Security for authorizing access to resources. Authentication is provided by the application server. |