Spring is a lightweight framework. It is treated as a framework of frameworks because it provides support to various frameworks such as Struts, Hibernate, Tapestry, EJB, JSF etc.
The framework, in broader sense, can be defined as a structure where we find solution of the various technical problems.The Spring framework comprises of several modules such as IOC, AOP, DAO, Context, ORM, WEB MVC etc
Spring modules comes with loads of design patterns.
In Proxy pattern, a class represents functionality of another class. This type of design pattern comes under structural pattern.
AOP, and remoting.
A Creational pattern involves a single class which is responsible to create an object while making sure that only single object gets created. This class provides a way to access its only object which can be accessed directly without need to instantiate the object of the class.
Beans defined in spring config files are singletons by default.
- Template –
A behaviour pattern, class exposes defined way /template(s) to execute its methods. Its subclasses can override the method implementation as per need but the invocation is to be in the same way as defined by the class.
Used extensively to deal with boilerplate repeated code (such as closing connections cleanly, etc..). For example JdbcTemplate, JmsTemplate, JpaTemplate.
Some obvious patterns in use in MVC:
- Model View Controller :
MVC Pattern stands for Model-View-Controller Pattern. This pattern is used to separate application’s concerns.
The advantage with Spring MVC is that your controllers are POJOs as opposed to being servlets. This makes for easier testing of controllers. One thing to note is that the controller is only required to return a logical view name, and the view selection is left to a separate ViewResolver. This makes it easier to reuse controllers for different view technologies.
- 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.