Я работаю над преобразованием проекта Spring 3 в Spring 4 + Spring Boot. Я пока не знаю, правильно это делать или нет. Я преобразовываю конфигурацию Spring Security XML в конфигурацию на основе Java следующим образом:
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/", "/home").permitAll()
.anyRequest().authenticated();
http.formLogin()
.defaultSuccessUrl("/afterLogin")
.loginPage("/profiles/lognin/form")
.failureUrl("/accessDenied")
.and()
.authorizeRequests()
.regexMatchers("....")
.hasRole("ROLE_USER")
.antMatchers("....")
.hasRole("ROLE_USER")
//....
;
}
@Override
protected void configure(AuthenticationManagerBuilder authManagerBuilder)
throws Exception {
authManagerBuilder.authenticationProvider(this.getDaoAuthenticationProvider());
}
// ....
}
Я получаю всплывающую панель входа Spring Security по умолчанию, когда нажимаю домашний URL. Мне кажется, что приведенная выше конфигурация не действует, но конфигурация Spring Security по умолчанию в Spring Boot не работает. Если да, то как переопределить значение по умолчанию?