Hi all,
I want to do some authorization-checks for domain objects. This includes checks if someone is allowed to instantiate an object (depending of it's type - this check is done externally so no need to solve this).
All our domain objects implement one specific interface (directly or indirectly)
What I need is an advice which runs after the instantiation of a domain object and is able to use the created instance (needed for the determination of the permission). (Additionally the advice may not execute when the constructor is called out of hibernate)
I want to implement this using AspectJ (which is working yet for methods) ideally using only static analysis as there are no a runtime dependent changes
Now I am trying to create an @AfterReturning adivce which intercepts constructor calls. But I do not get the pointcut working.
What I tried:
@Pointcut("within(a.b.c.DomainObject+) && execution(*.new(..))")
@Pointcut("execution(a.b.c.DomainObject+.new(..))")
But both does not work.
Does anyone know how I can achieve this?
Regards Michael