Reputation: 2658
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...
Upvotes: 5
Views: 22302
Reputation: 10184
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.
Upvotes: 1
Reputation: 7
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>
Upvotes: 0
Reputation: 1379
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 :)
Upvotes: 2
Reputation: 21
Simply you can do this :
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
Upvotes: 0
Reputation: 335
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
Upvotes: 7