I am working on converting a Spring 3 project to Spring 4 + Spring Boot. I do not know whether to do it right or not. I am converting Spring Security XML XML configuration to Java based configuration as follows:
@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")
I get the default Spring login window popup when I delete the home URL. It seems to me that the above configuration does not take effect, but by default Spring Security Configuration in Spring Boot does not work. If so, how to override the default value?
source share