Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Intertype definitions and annotations

Hi

I'm pretty this is not possible, but I wanted to hear it from the really experienced guys. Is it possible using intertype definitions to enhance/decorate classes/fields/methods with annotations...?

Exmaple: I have a web application where the infrastructure uses a @Secure annotation to define access control to Controllers. Since we have a lot of Controllers neatly placed in meaningfull packages, I wanted to define an Aspect where I could say all Controllers (there's an interface you can use to spot them out), that are in the com.mycompany.web.admin should have @Secure(roles="ROLE_ADMIN") added to their class declaration and all in package com.x.y should have @Secure(roles="ROLE_USER") finally the rest should be left alone.

The alternative way would be to write an Aspect that worked with the security infrastructure and used the packages to define the required roles, but just out of curiosity I would like to know if the other solution is at all possible (for cases where you have to play by the rules
and apply the annotations as the framework expects) ?

/Jeppe




Back to the top