title: Spring security access denied exception
body: <p>I have a web page which is connected to a spring <code>@component</code> class.
  There is a method that requires roles(by spring  annotation <code>@Secured('ROLE_USER')</code>) and it is called with a button.</p>
  
  <p>My problem is when i click the button without having the required role,it causes an error named access denied exception.I want to redirect the page to error a page when this occurs. I tried access-denied-handler on application context but it did not work.</p>
  
  <p>By the way, is <code>@component</code> tag enough or should i add something else such as <code>@controller</code>?</p>