java - Oauth2 在 Spring Boot 中不起作用

标签 java spring spring-boot spring-security spring-security-oauth2

我有关于 Spring Boot 的问题。我们的应用程序也充当授权服务器和资源服务器。我们向用户提供 token 并保护休息 Controller 。

现在我们开始新的应用程序,我们决定使用 Spring Boot 2.0.1。我们已经在之前的应用程序(1.5.X)中实现了 Oauth 配置,因此我们想使用它。但是当我们添加资源服务器和授权配置时,我们收到错误:

Cannot resolve symbol "XXX"

Spring 的所有 oauth2 功能都有 XXX,例如: @EnableResourceServer 注解、ResourceServerConfigurerAdapter、ResourceServerTokenServices、@EnableAuthorizationServer、AuthorizationServerConfigurerAdapter、JwtAccessTokenConverter 等等...

你能告诉我问题出在哪里吗?我们还在 pom 中添加了这些依赖项:

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

它们在 Idea 中也是红色的:

enter image description here

谢谢建议

最佳答案

自动配置功能已移至其自己的小库中。请参阅Spring Boot Migration Guide和链接的 Documentation .

关于java - Oauth2 在 Spring Boot 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49831167/

相关文章:

java - 尝试使用 Oracle + Spring Data Jpa 查询存储过程(存储函数)时出现错误

java - 如何从 OSGi 中的 BundleContext 获取 ComponentContext

spring - 无法创建内部bean'org.szymon.email.classes.MyMapperClass

java - 二级缓存 + Spring Boot + Java Hibernate 中的问题

spring-boot - Spring-Doc open api 无法与 Spring cloud 配置服务器 @EnableConfigServer 一起使用

java - Spring和Gradle构建:无此类属性:类的主类名称:org.gradle.api.internal.project.DefaultProject_Decorated

Java 正版 Windows 对话框

javascript - 如何通过鼠标悬停和鼠标移出来更改窗口状态?

java - Java中图像的无损再现

java.lang.ClassNotFoundException : org. springframework.ui.ModelMap 错误