上面帖子中的代码:
@Overrideprotected void configure(HttpSecurity http) throws Exception {http .authorizeRequests() .anyRequest().authenticated() .and() .formLogin() .loginPage("") .defaultSuccessUrl("/") .failureUrl("") .successHandler(//declare your bean here) .and() .logout() .permitAll() .and() }然后,在身份验证处理程序中,您可以应用所需的逻辑
public class MYSuccessHandler implements AuthenticationSuccessHandler {private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();@Overridepublic void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException { handle(request, response, authentication);}protected void handle(HttpServletRequest request, // logic redirectStrategy.sendRedirect(request, response, targetUrl);}protected String determineTargetUrl(Authentication authentication) { } }此处列出的教程http://www.baeldung.com/spring_redirect_after_login



