0

Does spring boot provides an implementation of 'chain of responsibility pattern'.

Something like the pipeline (request pipeline or a commerce pipeline ) .Where we can have the components involved added or removed based on configuration changes.

Philip
  • 13
  • 4
  • 1
    There is no pronounced way to implement it in Spring. By default you can do just an interface `ChainElement` and also additionally implement `Ordered` for each chain element realization class and inject a `List chain` and sort it in a init method of your handler class. So you will have something like a configurable chain, but it is more like a crunch) – Bogdan Oros Jan 31 '18 at 21:47

2 Answers2

0

It does not seem to me that Spring provides a generic implementation of the pattern.

There are specific components in Spring that work like chain of responsibility pattern, however. One example that comes to mind is the interceptor in Spring MVC. Each interceptor inspects and/or enriches the request before passing to the next one until the controller. Please note that there are differences between the two patterns.

Hillman Li
  • 63
  • 5
0

We just went with Spring IO using which we defined a pipeline

Philip
  • 13
  • 4