How does spring security loginPage become dynamic?

  1. by default loginPage is / login

No matter what url path you enter, it will automatically jump to the / login page

for example, typing: localhost:9090/login/123 in the URL column of the browser will automatically jump to localhost:9090/login, because the default is login.

but what I want is to type: / login/123, so the URL of the login page is / login/123, instead of / login, where 123 is a dynamic value?

        .formLogin().loginPage("/login").loginProcessingUrl("/qqlogin")
                .successHandler(customSuccessHandler).failureHandler(customErrorHandler)
                .permitAll()
                .and().sessionManagement().invalidSessionUrl("/login").maximumSessions(5).sessionRegistry(sessionRegistry())
                .and().and()
                .logout().logoutSuccessUrl("/login").permitAll()
                .and().headers().frameOptions().disable()
                .and().csrf().disable();

this is the configuration


because you have not configured which paths need to be logged in before you can access them, you can report 404 at most if you visit an address that does not exist.

.antMatchers("/admin/**").authenticated()
Menu