TL;DR: I've got an @Around-Interceptor using AspectJ that works fine on any @RestController but does not get called within any other @Service
AspectJ is activated using
@Configurable
@EnableAspectJAutoProxy
class AspectJConfig
This is my Aspect:
@Aspect
@Component
class EntitlementAspect(
    private val userService: UserService,
) {
    @Around("@annotation(RequiresEntitlementsAnyOf)")
    @Throws(EPTException::class)
    fun checkEntitlementsAnyOf(joinPoint: ProceedingJoinPoint): Any? {
        val signature = joinPoint.signature as MethodSignature
        val method = signature.method
        val annotation = method.getAnnotation(RequiresEntitlementsAnyOf::class.java)
        val entitlements = annotation.entitlements
        val user = userService.getCurrentUser()
        if (user.hasAnyEntitlementOf(*entitlements))
            return joinPoint.proceed()
        else throw ErrorCodeException(HttpStatus.FORBIDDEN, ErrorCodes.MISSING_PERMISSION)
    }
}
This does perfectly work on my Rest controller:
@RestController
class EcuVersionController(
    private val myTestService: TestService
) : BaseController() {
    @PostMapping
    @RequiresEntitlementsAnyOf([Entitlement.DEVELOPER])
    fun supply(@RequestParam id: UUID) {
        myTestService.doTest()
    }
}
However, when using the exact same annotation within the TestService that is called anyways, the aspect does not get called (checked using Debugger)
@RestController
class EcuVersionController(
    private val myTestService: TestService
) : BaseController() {
    @PostMapping
    fun supply(@RequestParam id: UUID) {
        myTestService.doTest()
    }
}
@Service
class TestService{
    fun doTest() {
        thisMethodShouldNotBeCalled()
    }
    @RequiresEntitlementsAnyOf([Entitlement.DEVELOPER])
    fun thisMethodShouldNotBeCalled() {
        // but it is called...
    }
}
I could not find any information about restrictions based on the containing class. Afaik, the aspect @annotation(RequiresEntitlementsAnyOf) should work for ANY method that has the annotation RequiresEntitlementAnyOf, no matter what kind of bean the method is contained in.
Any ideas?