I want to create WebSecurityConfig class that extends WebSecurityConfigurerAdapter, but I always get error "Cannot resolve symbol 'WebSecurityConfigurerAdapter'". I have already tried to add different dependencies. It's my gradle file
dependencies {
runtimeOnly 'org.postgresql:postgresql'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.5.1'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '3.0.0'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-rest', version: '3.0.0'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: '3.0.0'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '3.0.0'
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.5.1'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '3.0.0'
implementation group: 'org.springframework.security', name: 'spring-security-core', version: '6.0.0'
implementation group: 'org.springframework.security', name: 'spring-security-config', version: '6.0.0'
implementation group: 'org.springframework.security', name: 'spring-security-web', version: '6.0.0'
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose', version: '6.0.0'
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-resource-server', version: '6.0.0'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '3.0.0'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '3.0.0'
implementation group: 'org.thymeleaf.extras', name: 'thymeleaf-extras-springsecurity5', version: '3.1.0.RELEASE'
}
Maybe I don't understand something easy. Can you help me with this,please. I have already spent 2 days on this
There is the same question on stack overflow (Cannot resolve symbol WebSecurityConfigurerAdapter), but it doesn't help me. It's my file with WebSecurityConfig class
import nsu.project.springserver.security.jwt.AuthEntryPointJwt;
import nsu.project.springserver.security.jwt.AuthTokenFilter;
import nsu.project.springserver.security.services.UserDetailsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
....
}
CodePudding user response:
WebsecurityConfigurerAdapter was removed in Spring-boot 3.
Expose a SecurityFilterChain bean instead. Open the manual or have look at those tutorials.
CodePudding user response:
video from Dan Vega