Spring - design patterns used
Table of Contents
Name few Design Patterns used in Spring Framework
There are loads of different design patterns used, but there are a few obvious ones:
- Dependency injection – Center to the whole BeanFactory / ApplicationContext concepts.
- Singleton pattern – beans defined in spring config files are singletons by default.
- Front controller – Spring provides DispatcherServlet to ensure an incoming request gets dispatched to your controllers.
- Template method pattern – used extensively to deal with boilerplate repeated code e.g. RestTemplate, JmsTemplate, JpaTemplate.
- Proxy pattern – used heavily in AOP, and remoting.
- View Helper – Spring has a number of custom JSP tags, and velocity macros, to assist in separating code from presentation in views.
- Factory patterns – BeanFactory for creating instance of an object.
- Mediator pattern - refer to “Mediator Pattern in the Spring Framework”
- Visitor pattern