Pivotal Certified Professional Core Spring 5 Developer Exam A Study Guide Using Spring Framework wrote:Anyway, @RestController is different because it is a composed annotation that is meta-annotated with @Controller and @ResponseBody.
Because of that @RestController cannot be treated the same way as @Controller and thus it cannot be a stereotype annotation if it cannot be treated the same as one.
You can register aspect classes as regular beans in your Spring XML configuration or autodetect them through classpath scanning — the same as any other Spring-managed bean. However, note that the @Aspect annotation is not sufficient for autodetection in the classpath. For that purpose, you need to add a separate @Component annotation (or, alternatively, a custom stereotype annotation that qualifies, as per the rules of Spring’s component scanner).