1

Regarding answer, I have tried the same and for JSP part it is working fine. I have used @PreAuthorize annotation on controller and tried it on service layer as well but hasPermission method of MySecurityService is not getting called.

I have added global method security pre post enabled as well in my spring-security-context.xml.

Please help.

Community
  • 1
  • 1
VJS
  • 2,891
  • 7
  • 38
  • 70
  • 3
    The annotations will only work if they are on components in the same contexts as you have defined the `global-method-security` in. If that is in the `ContextLoaderListener` and your components live in the `DispatcherServlet` it isn't going to work. The same applies for all other AOP related options (transactions, scheduling etc.). – M. Deinum Nov 18 '14 at 09:29
  • yes. thanks. I have written global-method-security in servlet-context.xml and now its working fine. – VJS Nov 18 '14 at 11:42

0 Answers0