WebSecurityConfigurerAdapter not found
Asked Answered
R

5

5

My build.gradle contains:

compile('org.springframework.security:spring-security-web:4.1.3.RELEASE')

Did a "refresh all gradle projects" (im using IntelliJ!)

When i want to extend WebSecurityConfigurerAdapter it says "Create class ...."

The namespace where WebSecurityConfigurerAdapter should be is also not found...

See http://docs.spring.io/spring-security/site/docs/current/apidocs/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.html

Ratha answered 12/10, 2016 at 14:13 Comment(1)
I faced same problem with eclipse , I added spring-security-config in build.gradle , but still eclipse could not found the class. Then I just copied the the entire class path and added as import -- import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; It worked this way.Tawnytawnya
C
7

add maven dependency spring config like this

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-config</artifactId>
    <version>4.1.3.RELEASE</version>
</dependency>

or download jar and connect to your project

Charisecharisma answered 22/10, 2016 at 7:27 Comment(0)
S
2

I faced this issue when I added the wrong dependency package from maven. By mistake, I added spring-security-web instead of spring-boot-starter-security.

Please add

spring-boot-starter-security

and it will work :)

Sclaff answered 26/8, 2020 at 11:40 Comment(0)
I
1

If you are using a newer version (> 5.7.0) of spring-boot and hence spring-boot-starter-security, the class WebSecurityConfigurerAdapter is deprecated. See the notes on the GitHub issue. Now on you need to declare beans for each type of component (web, http, etc) that you are trying to configure security for.

Impolicy answered 31/5, 2023 at 23:35 Comment(0)
S
0

Simply you can do this :

import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
Salamone answered 20/1, 2020 at 17:55 Comment(0)
F
0
Add these dependencies in the pom file in the maven project.
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-test</artifactId>
    <scope>test</scope>
</dependency>
Formative answered 25/5, 2022 at 11:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.