首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >找不到EnableOAuth2Sso注释的导入

找不到EnableOAuth2Sso注释的导入
EN

Stack Overflow用户
提问于 2018-04-12 13:46:01
回答 1查看 1.8K关注 0票数 2

我试着重复以下教程:

http://www.baeldung.com/sso-spring-security-oauth2

我有以下依赖关系:

代码语言:javascript
运行
复制
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')
}

我有一节课:

代码语言:javascript
运行
复制
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注释。这并不意味着我会自动完成导入。

我做错什么了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-04-12 13:52:13

我代替了

代码语言:javascript
运行
复制
 compile("org.springframework.security.oauth:spring-security-oauth2:2.3.2.RELEASE")

使用

代码语言:javascript
运行
复制
compile ("org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.0.0.RELEASE")

和想法发现的重要性

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49798251

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档