Osk*_*tha 10 authentication spring spring-security classnotfoundexception server
我是 Spring Boot 空间的新手。我正在按照教程学习创建 OAuth 身份验证服务器。
配置AuthorizationServerConfig.java讲师时,从包“org.springframework.security.oauth2.server.authrization.config”导入“ProviderSettings”类
但是,我没有从该特定包中获得该类。
我缺少任何依赖项吗?或者该课程现在不可用?
参考文献 1:错误点。无法解析符号 ProviderSettings
@Bean
public ProviderSettings providerSettings(){
return ProviderSettings.builder()
.issuer("http://auth-server:9000")
.build();
}
Run Code Online (Sandbox Code Playgroud)
参考2:pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>np.com.oskarshrestha</groupId>
<artifactId>Oauth-authorization-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Oauth-authorization-server</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-authorization-server</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
I tried to find the correct import for the required class i.e. 'ProviderSettings'
Cross checked dependencies.
Run Code Online (Sandbox Code Playgroud)
fra*_*pow 25
你不会相信我,但我几分钟前刚刚解决了这个问题。看起来该指南使用的是过时的版本,
spring-security-oauth2-authorization-server并且他们已重命名
ProviderSettings to AuthorizationServerSettings
https://github.com/spring-projects/spring-authorization-server/issues/864
https://github.com/spring-projects/spring-authorization-server/issues/681
https://github.com/spring-projects/spring-authorization-server/issues/986
他们应该将这些更改添加到文档中或使其更加清晰(IMO)
| 归档时间: |
|
| 查看次数: |
3196 次 |
| 最近记录: |