Using @annotation with Spring Security Annotations
I have a service interface that has a method that looks like the following:
Code:
package com.foo.svcs;
public interface FooService {
@PreAuthorize("ROLE_USER")
@com.foo.svcs.CustomAnnotation
public void doSomething();
}
My Spring application context xml configuration file looks partially like:
HTML Code:
<bean id="foo" class="com.foo.svcs.FooServiceImpl" />
<sec:global-method-security pre-post-annotations="enabled" access-decision-manager-ref="serviceAccessDecisionManager">
<sec:expression-handler ref="expressionHandler"/>
</sec:global-method-security>
<aop:config>
<aop:advisor pointcut="execution(* com.foo.svcs.*.*(..)) and @annotation(com.foo.svcs.CustomAnnotation)" advice-ref="aceCreator" />
</aop:config>
I've found that when using the @annotation pointcut, my advice is not executed (even when removing the execution clause). However, if I do pointcut="bean(foo)" then my advice is executed. I am wondering if the proxies that are being created for the PrePost Spring Security annotation support are "hiding" my custom annotation on the service. Is that what's happening here, or is something else wrong?