I found that generally Spring annotations are recommended to be placed on implementation for example @Transactional, but where to place @PreAuthorized?
Asked
Active
Viewed 2,012 times
4
-
2Generally speaking, you want to ask yourself "what this annotation a part of?". If it's a part of contract you want to expose to consumers of your beans/API, then put it in interface. If your consumers do not need to know about this in general, then its place is among implementation details. – M. Prokhorov Mar 12 '18 at 14:53
1 Answers
4
In official Spring Docs https://docs.spring.io/spring-security/site/docs/current/reference/html/authorization.html#el-pre-post-annotations they add these to the interface methods.
But I think you can add them also on the implementation.

mrkernelpanic
- 4,268
- 4
- 28
- 52