What Are Spring Modules/Different modules of the spring frame work?
Spring Core Model:-
This Core Module is the base module of a spring frame work application.
This Core Module will provide the following information to the spring programmers.
- The way of creating spring Beans.
- The way of Configuring Spring Beans.
- The way of injecting the dependencies.
- The way of obtaining a spring container object.
- The way of accessing the spring beans from container.
The core container provides the essential functionality of the Spring framework. A primary component of the core container is the BeanFactory, an implementation of the Factory pattern. The BeanFactory applies the Inversion of Control (IOC) pattern to separate an application’s configuration and dependency specification from the actual application code.
2)Spring DAO (JDBC) Module:-
This Module will provide an abstraction layer on top of JDBC technology.While working with JDBC technology directly as programmers, we are writing the Boiler-plate code (Repeated code) like Loading the driver, opening a connection, creating a statement and closing the objects etc…
Apart from Boiler-plate code, we also need to handle the Exceptions of JDBC explicitly because JDBC Exceptions are checked exceptions.
In order to avoid the Boiler-plate code and to also avoid exception handling Burdon, spring frame work has provided this DAO module.
The Spring JDBC DAO abstraction layer offers a meaningful exception hierarchy for managing the exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the amount of exception code you need to write, such as opening and closing connections. Spring DAO’s JDBC-oriented exceptions comply to its generic DAO exception hierarchy.
3)Spring ORM Module:-
This ORM Module is an abstraction layer on top of the ORM tools and which makes a spring programmer to transfer a data between application and database in the form of objects.ORM tools are very good tools for communicating with databases but having some drawbacks, these drawbacks are eliminated in spring ORM module.
The Spring framework plugs into several ORM frameworks to provide its Object Relational tool, including JDO, Hibernate, and iBatis SQL Maps. All of these comply to Spring’s generic transaction and DAO exception hierarchies.
4)Spring AOP Module:-
Aspect Oriented Programming is a new way to developing real time applications with required services
The AOP module will provide us the way of separating the services from Business logic and also it provides us the way of injecting the services for business logic at runtime.
In spring terminology, the services are also called “Cross-Cutting Concerns” (Middle ware services).
The Spring AOP module integrates aspect-oriented programming functionality directly into the Spring framework, through its configuration management feature. As a result you can easily AOP-enable any object managed by the Spring framework. The Spring AOP module provides transaction management services for objects in any Spring-based application. With Spring AOP you can incorporate declarative transaction management into your applications without relying on EJB components.
5)Spring JEE Module:-
This Module is for implementing the middleware services required for Business logic. This spring JEE module is an abstraction layer on top of RMI, Java mail, JMS, Jars etc…
There is a difference between AOP and JEE modules
AOP is just for applying the services (or) injecting the services but not for implementing the services, whereas JEE is a module for implementing the services.
For real time Business logic development with middleware services, we use spring core, spring AOP, and spring JEE modules.
The Model-View-Controller (MVC) framework is a full-featured MVC implementation for building Web applications. The MVC framework is highly configurable via strategy interfaces and accommodates numerous view technologies including JSP, Velocity, Tiles, iText, and POI.
6)Spring Web Module:-
This module is either for integrating with web applications created in other frame works (or) for creating complete MVC to based web application in spring frame work.
Spring web module is also called Spring web MVC module and this module is for creating web applications of java with MVC to architecture.
The Web context module builds on top of the application context module, providing contexts for Web-based applications. As a result, the Spring framework supports integration with Jakarta Struts. The Web module also eases the tasks of handling multi-part requests and binding request parameters to domain objects.
Some of the design patterns used in Spring Framework?
There are loads of different design patterns used, but there are a few obvious ones:
• Proxy — used heavily in AOP, and remoting.
• Singleton — beans defined in spring config files are singletons by default.
• Template method — used extensively to deal with boiler plate repeated code e.g. RestTemplate, JmsTemplate, JpaTemplate.
• Front Controller — Spring provides DispatcherServlet to ensure an incoming request gets dispatched to your controllers.
• View Helper — Spring has a number of custom JSP tags, and velocity macros, to assist in separating code from presentation in views.
• Dependency injection — Center to the whole BeanFactory / ApplicationContext concepts.
• Factory pattern — BeanFactory for creating instance of an object.
In the Spring 3 many new and improved features are added. It’s support for the RESTful web services . The Spring 3 framework allows the developers to develop RESTful web services using Spring Framework. The RESTful web services is based on the SOAP.
Here is the list of new Modules introduced in the Spring 3:
New Features in Spring 3
Below is the brief list of the features in Spring 3:
- REST support for Spring Web MVC
- Spring EL
- Portlet 2.0 support
- Model Validation
- Type-Conversion System
- Factory annotations
- Object/XML Mapping (OXM) Module
- Converter SPI
- Converter API
- Formatter SPI and APIs
- Injecting the Converters
Beside the above features Spring 3 also leverage the features provided in Java 5 and Java 6