GUJ Discussões   :   últimos tópicos   |   categorias   |   GUJ Respostas

Spring Security

java
spring
framework
web
Tags: #<Tag:0x00007fb3c8b74b88> #<Tag:0x00007fb3c8b74a20> #<Tag:0x00007fb3c8b74890> #<Tag:0x00007fb3c8b74700>

#1

Tô começando com Spring Security e logo de cara me deparei com um problema. Alguém sabe como resolver?

Obs1: uso JSE 1.8 update 121

Multiple markers at this line_
- The type org.springframework.security.web.DefaultSecurityFilterChain cannot be resolved. It is indirectly referenced from required .class files
- The type org.springframework.security.authentication.AuthenticationManager cannot be resolved. It is indirectly referenced from required .class files

Esse problema foi dado no SecurityConfig.java, segue o código:

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

	@Override
	protected void configure(AuthenticationManagerBuilder auth) throws Exception {
		auth.inMemoryAuthentication()
			.withUser("admin").password("admin").roles("ROLE");
	}	
}

dependencia: pom.xml

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>