JAVA-14679 Update spring-boot-bootstrap module under spring-boot-modules to remove usage of deprecated WebSecurityConfigurerAdapter

This commit is contained in:
anuragkumawat 2022-09-20 20:00:27 +05:30
parent 2842e5cee7
commit db79faf569
1 changed files with 9 additions and 6 deletions

View File

@ -1,20 +1,23 @@
package com.baeldung.config; package com.baeldung.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.web.SecurityFilterChain;
@Configuration @Configuration
@EnableWebSecurity @EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter { public class SecurityConfig {
@Override @Bean
protected void configure(HttpSecurity http) throws Exception { public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeRequests() http.authorizeRequests()
.anyRequest() .anyRequest()
.permitAll() .permitAll()
.and().csrf().disable(); .and()
.csrf()
.disable();
return http.build();
} }
} }