Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type org.springframework.security.authentication.AuthenticationManager cannot be resolved. It is indirectly referenced from required .class files

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication().withUser("abcde").password("123456").roles("USER");   
}

and i am getting an error in the last line, it says that

The type org.springframework.security.authentication.AuthenticationManager cannot be resolved. It is indirectly referenced from required .class files

I have looked for a solution and cannot find a way to fix it.

like image 854
mchinta Avatar asked May 17 '16 09:05

mchinta


2 Answers

Add spring-security-core to your build path. If you already have one, download the latest version.

 <dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>
    <version>5.0.0.RELEASE</version>
 </dependency>

after mvn clean install , if you still see error in eclipse. refresh the project. This worked for me.

like image 121
Sarat Chandra Avatar answered Sep 19 '22 04:09

Sarat Chandra


Add spring-security-core.jar to the Build Path of the project. If you are using Eclipse, right click on project --> Properties --> Java Build Path --> Libraries --> click Add jars or Add external jars and point to the jar file.

Also, do clean build.

like image 21
Radhakrishna Sharma Gorenta Avatar answered Sep 19 '22 04:09

Radhakrishna Sharma Gorenta