Spring - design patterns used

Name few Design Patterns used in Spring Framework

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

  1. Dependency injection – Center to the whole BeanFactory / ApplicationContext concepts.
    1. Inversion of Control
    2. Dependency Injection pattern
  2. Singleton pattern – beans defined in spring config files are singletons by default.
  3. Front controller – Spring provides DispatcherServlet to ensure an incoming request gets dispatched to your controllers.
  4. Template method pattern – used extensively to deal with boilerplate repeated code e.g. RestTemplate, JmsTemplate, JpaTemplate.
  5. Proxy pattern – used heavily in AOP, and remoting.
  6. View Helper – Spring has a number of custom JSP tags, and velocity macros, to assist in separating code from presentation in views.
  7. Factory patterns – BeanFactory for creating instance of an object.
  8. Mediator pattern - refer to “Mediator Pattern in the Spring Framework”
  9. Visitor pattern

References

  1. https://howtodoinjava.com/interview-questions/top-spring-interview-questions-with-answers/#1-what-is-spring-framework-what-are-its-main-modules

Links to this note