Spring Boot- und Spring-Sicherheit mehrere Anmeldeseiten

@EnableWebSecurity
public class MultiHttpSecurityConfig {

@Configuration
@Order(1)
public static class App1ConfigurationAdapter extends WebSecurityConfigurerAdapter {
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable().authorizeRequests()
        .antMatchers("/my/**", "/account/**").access("hasRole('ROLE_USER') or hasRole('ROLE_ADMIN')")
        .and().formLogin().loginPage("/login");
    }
}

@Configuration
@Order(2)
public static class App2ConfigurationAdapter extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable().authorizeRequests()
        .antMatchers("/admin/**").access("hasRole('ROLE_ADMIN')")
        .and().formLogin().loginPage("/adminlogin");
    }
}
}

Dies sollen zwei verschiedene Anmeldeformulare sein. Mein Problem ist, dass der mit der höchsten Bestellung / Adminlogin nicht angezeigt wird. Ich habe eine Idee warum? Bitte helfen Sie. Der Code ist vonSpring Boot - Wie konfiguriere ich mehrere Anmeldeseiten?

Folgend Sofias Vorschlag habe ich Folgendes versucht:

@Configuration
@Order(2)
public static class UserConfigurationAdapter extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
        .requestMatcher(new AntPathRequestMatcher("/my/**"))
        .csrf().disable()      
        .authorizeRequests().antMatchers("/my/**").access("hasRole('ROLE_USER')")
        .and().formLogin().loginPage("/login");
    }
}

@Configuration
@Order(1)
public static class AdminConfigurationAdapter extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
        .requestMatcher(new AntPathRequestMatcher("/admin/**"))
        .csrf().disable()      
        .authorizeRequests().antMatchers("/admin/**").access("hasRole('ROLE_ADMIN')")
        .and().formLogin().loginPage("/adminlogin");
    }
}

Aber in beiden Fällen heißt / login

Antworten auf die Frage(2)

Ihre Antwort auf die Frage