Ошибка пути к классам с spring-security-oauth2-autoconfigure: EnableResourceServer не найден - PullRequest
0 голосов
/ 03 октября 2018

Я создал проект в Github , чтобы продемонстрировать эту проблему.Почему в classpath нет org.springframework.security.oauth2.config.annotation.web.configuration?

У меня есть существующий проект Spring Boot 1.5.x с использованием Spring Security 4.x, который я пытаюсь выполнитьобновить до Spring Boot 2.x с Spring Security 5.x, используя spring-security-oauth2-autoconfigure:

<dependency>
  <groupId>org.springframework.security.oauth.boot</groupId>
  <artifactId>spring-security-oauth2-autoconfigure</artifactId>
  <version>2.0.5.RELEASE</version>
</dependency>

Вот один из неудачных импортов:

import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;

Application.java: [9,79] пакета org.springframework.security.oauth2.config.annotation.web.configuration не существует [ОШИБКА] / Пользователи / stevemitchell / Загрузки / problem-spring-security-oauth2-boot / src/main/java/com/demo/service/auth/Application.java:[16,2] не может найти символ символа: класс EnableResourceServer

Я вижу org.springframework.security.oauth: spring-security-oauth2: jar: 2.3.3.RELEASE: среда выполнения в "зависимости mvn: дерево".

$ mvn dependency:tree
...
[INFO] \- org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:jar:2.0.5.RELEASE:compile
[INFO]    +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO]    +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
[INFO]    |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
[INFO]    +- org.springframework.boot:spring-boot:jar:2.0.5.RELEASE:compile
[INFO]    +- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.5.RELEASE:compile
[INFO]    +- org.springframework.security.oauth:spring-security-oauth2:jar:2.3.3.RELEASE:runtime
[INFO]    |  +- org.springframework:spring-webmvc:jar:5.0.9.RELEASE:compile
[INFO]    |  +- commons-codec:commons-codec:jar:1.11:runtime
[INFO]    |  \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:runtime
[INFO]    |     \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:runtime
[INFO]    +- org.springframework.security:spring-security-jwt:jar:1.0.9.RELEASE:compile
[INFO]    |  \- org.bouncycastle:bcpkix-jdk15on:jar:1.56:compile
[INFO]    |     \- org.bouncycastle:bcprov-jdk15on:jar:1.56:compile
[INFO]    \- org.springframework:spring-web:jar:5.0.9.RELEASE:compile

Это должно скомпилироваться.Чего мне не хватает?

1 Ответ

0 голосов
/ 09 мая 2019

Вы должны использовать версию 2.0.8 или ниже https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2/2.0.8.RELEASE

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...