• Post Reply Bookmark Topic Watch Topic
  • New Topic

Which design pattern in used in Spring AOP  RSS feed

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Recently in an interview, I faced this  below question

Which design pattern in used in Spring AOP?

I was dumbstruck to answer this. Could some shed some light and help me in understanding the design pattern used.
 
Ranch Hand
Posts: 51
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Template method - used extensively to deal with boilerplate repeated code (such as closing connections cleanly, etc..). For example JdbcTemplate, JmsTemplate, JpaTemplate.
 
Ranch Hand
Posts: 31
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

spring is a collection of best-practise API patterns, you can write up a shopping list of them as long as your arm. The way that the API is designed encourages you (but doesn't force you) to follow these patterns, and half the time you follow them without knowing you are doing so.
 
Sheriff
Posts: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Proxy pattern may or may not be used in AOP, it depends on the implementation but yes for Spring it is used. Same goes for singletons, Spring beans may or may not be singletons and spring beans being singleton has nothing to do with AOP. You can even say that AOP is like Decorator design pattern. But more than design patterns, AOP is about the issues it solves. It gives you a way to handle cross cutting concerns...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!