What are the design patterns used in Spring Framework?

There are loads of different design patterns used, but there are a few obvious ones:

1. Dependency Injection : which is central to the whole BeanFactory/ ApplicationContext.
2. Proxy : Used heavily in AOP (Aspect Oriented Programming) and remoting.
3. Singleton : Beans defined in Spring configuration files are singletons by default.
4. Template Method : used extensively to deal with boilerplate code such as closing connections cleanly, for example, JdbcTemplate, JmsTemplate, JpaTemplate.
5. MVC (Model View Controller) : 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 is that hte 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.
6. Front Controller: Spring provides DispatcherServlet to ensure an incoming requests gets dispatched to your controllers.
7. View Helper : Spring has number of custom JSP tags, and velocity macros, to assist in separating code from presentation in views. 

Comments