What do you think about putting business logic into a Spring interceptor/Advice? Is it a bad practice?
Which kind of business logic would you put in an interceptor? just validations?
What I see is that business logic in an interceptor is harder to see because there is not a clear chain of method calls to follow. And also business logic should is supposed to be at Domain Objects if you use domain driven design.
Thanks in advance.
As a general rule, AOP interceptors should be used for cross-cutting concerns, not for base business logic. I've seen applications that use AOP, and some developers swear by them. If find them a nightmare to debug and test.
It quickly becomes a combinatorial problem, finding the different aspects that intersect to combine to create the desired user behavior. It is much easier to determine business logic in systems that are linear and explicit in their business logic invocation.