Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EnableWebSecurity cannot be resolved to a type

The screenshot of error is here.I am new to spring security and was trying to implement this tutorial http://websystique.com/spring-security/angularjs-basic-authentication-using-spring-security/

But my dependencies are not getting resolved as none of the class of prefix org.springframework.security.config.* is getting resolved to a type I have already included 3 jars:

spring-security-web-3.1.2-RELEASE.jar 
spring-security-core-3.1.2-RELEASE.jar
spring-security-config-3.1.2-RELEASE.jar

still the error is coming. Is there any other jar I am missing? NOTE-I am not using maven

like image 212
Sheetal Jain Avatar asked Sep 05 '25 03:09

Sheetal Jain


2 Answers

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
    <version>2.0.4.RELEASE</version>
</dependency>
like image 59
Black Avatar answered Sep 07 '25 20:09

Black


As explained in this answer

Spring Security 3.1.3 @EnableWebSecurity

java config support is not released with Spring Security 3.1.2. I suggest to update spring security to a newer version. Download version 3.2.9 and you will find the missing packages.

This is the link to the spring repository:

http://repo.spring.io/release/org/springframework/security/spring-security/3.2.9.RELEASE/

like image 34
amicoderozer Avatar answered Sep 07 '25 22:09

amicoderozer