Spring Framework Usage scenarios
There are 4 ways to use Spring framework:
1. Typical full-fledged Spring web application
You can use Spring in all sorts of scenarios, from applets up to fully-fledged enterprise applications using Spring’s transaction management functionality and web framework integration.
By using Spring’s declarative transaction management features the web application is fully transactional, just as it would be when using container managed transactions as provided by Enterprise JavaBeans. All your custom business logic can be implemented using simple POJOs, managed by Spring’s IoC container. Additional services include support for sending email, and validation that is independent of the web layer enabling you to choose where to execute validation rules. Spring’s ORM support is integrated with JPA, Hibernate, JDO and iBatis; for example, when using Hibernate, you can continue to use your existing mapping files and standard Hibernate
2. Spring middle-tier using a third-party web framework
SessionFactory
configuration. Form controllers seamlessly integrate the web-layer with the domain model, removing the need for ActionForms
or other classes that transform HTTP parameters to values for your domain model.2. Spring middle-tier using a third-party web framework
Sometimes the current circumstances do not allow you to completely switch to a different framework. The Spring Framework does not force you to use everything within it; it is not an all-or-nothing solution. Existing front-ends built using WebWork, Struts, Tapestry, or other UI frameworks can be integrated perfectly well with a Spring-based middle-tier, allowing you to use the transaction features that Spring offers. The only thing you need to do is wire up your business logic using an
ApplicationContext
and integrate your web layer using a WebApplicationContext
.3. Remoting usage scenario
When you need to access existing code via web services, you can use Spring’s
Hessian-
, Burlap-
, Rmi-
or JaxRpcProxyFactory
classes. Enabling remote access to existing applications suddenly is not that hard anymore.4. EJBs – Wrapping existing POJOs
The Spring Framework also provides an access- and abstraction- layer for Enterprise JavaBeans, enabling you to reuse your existing POJOs and wrap them in Stateless Session Beans, for use in scalable, failsafe web applications that might need declarative security.