【发布时间】:2014-06-26 14:23:16
【问题描述】:
我正在使用 WebSecurityConfigurerAdapter,我想知道是否有办法配置 WebSecurityConfigurerAdapter 中的错误处理程序,就像它曾经在 web.xml 中一样 我想捕获我所有的 UsernameNotFoundException/401 并处理它。
示例:
<error-page>
<error-code>401</error-code>
<location>/SngErrorHandler</location>
</error-page>
<error-page>
<exception-type>org.springframework.security.core.userdetails.UsernameNotFoundException</exception-type>
<location>/SngErrorHandler</location>
</error-page>
【问题讨论】:
标签: java spring jakarta-ee servlets