找不到 EnableOAuth2Sso 注释的导入
Could not find import for EnableOAuth2Sso annotation
我尝试重复以下教程:
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')
}
我有以下 class:
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")
并且 Idea 找到了导入
我尝试重复以下教程:
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')
}
我有以下 class:
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")
并且 Idea 找到了导入