This question already has an answer here:
EnableOAuth2Sso Annotation Missing On Upgrade To Spring Boot 2 [duplicate]
(1个答案)
2年前关闭。
我尝试重复以下教程:
http://www.baeldung.com/sso-spring-security-oauth2
我有以下依赖性:
我有以下课程:
如您所见,我没有导入
我怎么了
与
和想法发现进口
(1个答案)
2年前关闭。
我尝试重复以下教程:
http://www.baeldung.com/sso-spring-security-oauth2
我有以下依赖性:
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
compile('org.springframework.boot:spring-boot-starter-security')
compile("org.springframework.security.oauth:spring-security-oauth2:2.3.2.RELEASE")
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.thymeleaf.extras:thymeleaf-extras-springsecurity4:2.1.2.RELEASE')
}
我有以下课程:
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableOAuth2Sso
public class UiSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http.antMatcher("/**")
.authorizeRequests()
.antMatchers("/", "/login**")
.permitAll()
.anyRequest()
.authenticated();
}
}
如您所见,我没有导入
@EnableOAuth2Sso
注释。而且Idea不建议我导入automcomplete。我怎么了
最佳答案
我更换了
compile("org.springframework.security.oauth:spring-security-oauth2:2.3.2.RELEASE")
与
compile ("org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.0.0.RELEASE")
和想法发现进口
10-04 20:16