springspring-mvcspring-securitypre-authentication

Issue with @PreAutorize annotation with Spring Security


@PreAuthorize is not working in Spring Security 3.

This is my code snap.

 @PreAuthorize("hasRole('Admin') or hasRole('Student')")
 public void doSomething(){}

It is giving me weird error (refer attachment) enter image description here


Solution

  • for other interested people..

    I fixed issue by adding

    <aop:config proxy-target-class="true"></aop:config> 
    

    line in spring-security.xml