Не удалось обработать кандидатов на импорт для облачного шлюза класса конфигурации Spring

. ____ _ __ _ _ / \ / ' __ _ () __ __ _ \ \
(() _
_ | '_ |' | | ' / `| \ \ \
\ / __ ) | |) | | | | | || (
| |)))) '| | .__ | | | | | | _ , | / / / / ========= | | ============== | / = / / < em> / / :: Spring Boot :: (v2.4.1)

2021-01-13 10: 43: 21.414 INFO 17304 --- [main] cscgateway.CloudGatewayApplication: запуск CloudGatewayApplication с использованием Java 1.8.0_271 на Ajinas с PID 17304 (D: \ microservice \ cloud-gateway \ target \ classes запущен пользователь в D: \ microservice \ cloud-gateway) 2021-01-13 10: 43: 21.421 INFO 17304 --- [main] cscgateway.CloudGatewayApplication: Активный профиль не установлен, возврат к профилям по умолчанию: по умолчанию 2021-01- 13 10: 43: 22.659 ПРЕДУПРЕЖДЕНИЕ 17304 --- [main] osboot.actuate.endpoint.EndpointId: Идентификатор конечной точки 'hystrix.stream' содержит недопустимые символы, перейдите к допустимому формату. 2021-01-13 10: 43: 23.161 ПРЕДУПРЕЖДЕНИЕ 17304 --- [main] onfigReactiveWebServerApplicationContext: исключение во время инициализации контекста - отмена попытки обновления: org.springframework.beans.factory.BeanDefinitionStoreException: не удалось обработать кандидатов на импорт для класса конфигурации [com .study.cloud.gateway.CloudGatewayApplication]; вложенное исключение - java.io.FileNotFoundException: ресурс пути к классу [org / springframework / boot / autoconfigure / web / ServerPropertiesAutoConfiguration.class] не может быть открыт, потому что он не существует 2021-01-13 10: 43: 23.198 INFO 17304 --- [main] ConditionEvaluationReportLoggingListener:

Ошибка запуска ApplicationContext. Чтобы отобразить отчет об условиях, повторно запустите приложение с включенной отладкой. 2021-01-13 10: 43: 23.261 ОШИБКА 17304 --- [main] o.s.boot.SpringApplication: сбой при запуске приложения

4.0.0 org.springframework.boot spring-boot-starter-parent 2.4.1 com.study cloud-gateway 0.0.1-SNAPSHOT cloud-gateway Демонстрационный проект для микросервисов Spring Boot

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;

@SpringBootApplication
@EnableEurekaClient
@EnableHystrix
public class CloudGatewayApplication {

    public static void main(String[] args) {
        SpringApplication.run(CloudGatewayApplication.class, args);
    }

}

spring:
  application:
    name: GATEWAY-SERVICE
  cloud:
    gateway:
      routes:
      - id: order-service
        uri: lb://ORDER-SERVICE
        predicates:
        - Path=/order/**
        filters:
        - name: Circuit-Breaker
          args:
            name: order-service
            fallbackuri: forward:/orderFallBack 
      - id: payment-service
        uri: lb://PAYMENT-SERVICE
        predicates:
        - Path=/payment/**
        filters:
        - name: Circuit-Breaker
          args:
            name: payment-service
            fallbackuri: forward:/orderFallBack
eureka:
  client:
    register-with-eureka: true
    fetch-registry: true
    service-url:
      defaultZone: http://localhost:8761/eureka/
  instance:
    hostname: localhost
    
server:
  port: 8989
  
management:
  endpoints:
    web:
      exposure:
        include: hystrix.stream

hystrix:
  command: 
    fallbackcmd:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 5000

Я столкнулся с аналогичной проблемой, моя была связана с импортом зависимостей maven. Попробуйте запустить приложение, добавив следующие зависимости:

<properties>
    <java.version>1.8</java.version>
    <spring-cloud.version>2020.0.0</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-gateway</artifactId>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-hystrix -->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-hystrix</artifactId>
        <version>1.4.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
    </repository>
</repositories>

person Ajinas Ibrahim    schedule 13.01.2021    source источник


Ответы (1)


а также удалите существующую зависимость:


<dependency>
    <groupId>org.springframework.cloud</groupId>        
    <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
    <version>2.2.2.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-circuitbreaker-reactor-resilience4j</artifactId>
</dependency>

org.springframework.beans.factory.BeanDefinitionStoreException: не удалось обработать кандидатов на импорт для класса конфигурации [com.study.cloud.gateway.CloudGatewayApplication]; вложенное исключение - java.io.FileNotFoundException: ресурс пути к классу [org / springframework / boot / autoconfigure / web / ServerPropertiesAutoConfiguration.class] не может быть открыт, потому что он не существует в org.springframework.context.annotation.ConfigurationClassParser.processImports (ConfigurationClassParser.processImports. java: 610) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework.context.annotation.ConfigurationClassParser.access $ 800 (ConfigurationClassParser.java:111) ~ [spring-context-5.3.2. jar: 5.3.2] в org.springframework.context.annotation.ConfigurationClassParser $ DeferredImportSelectorGroupingHandler.lambda $ processGroupImports $ 1 (ConfigurationClassParser.java:812) ~ [spring-context-5.3.2.jar: 5.3.2] в java.util .ArrayList.forEach (неизвестный источник) ~ [na: 1.8.0_271] в org.springframework.context.annotation.ConfigurationClassParser $ DeferredImportSelectorGroupingHandler.processGroupImports (ConfigurationClassParser.java:809) ~ [spring-context-5.3.2 .2] в org.springframework.context.annotation.C onfigurationClassParser $ DeferredImportSelectorHandler.process (ConfigurationClassParser.java:780) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework.context.annotation.ConfigurationClassParser.parse (ConfigurationClassParser.java [spring:193) ~ -context-5.3.2.jar: 5.3.2] в org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions (ConfigurationClassPostProcessor.java:336) ~ [spring-context-5.3.2.jar: 5.3.2] в org .springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry (ConfigurationClassPostProcessor.java:252) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework.context.support.PvoProcessingRegistryDefinition.PvoProcessorRegistryDefinition.PvoProcessorRegistryDescription: 285) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors (PostProcessorRegistrationDelegate.java:99) ~ [spring-context-5.3.2 .jar: 5.3.2] в org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors (AbstractApplicationContext.java:751) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework.context.support .AbstractApplicationContext.refresh (AbstractApplicationContext.java:569) ~ [spring-context-5. 3.2.jar: 5.3.2] в org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh (ReactiveWebServerApplicationContext.java:63) ~ [spring-boot-2.4.1.jar: 2.4.1] в org. springframework.boot.SpringApplication.refresh (SpringApplication.java:767) [spring-boot-2.4.1.jar: 2.4.1] в org.springframework.boot.SpringApplication.refresh (SpringApplication.java:759) [spring-boot -2.4.1.jar: 2.4.1] в org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:426) [spring-boot-2.4.1.jar: 2.4.1] в org.springframework.boot. SpringApplication.run (SpringApplication.java:326) [spring-boot-2.4.1.jar: 2.4.1] в org.springframework.boot.SpringApplication.run (SpringApplication.java:1309) [spring-boot-2.4.1 .jar: 2.4.1] в org.springframework.boot.SpringApplication.run (SpringApplication.java:1298) [spring-boot-2.4.1.jar: 2.4.1] в com.study.cloud.gateway.CloudGatewayApplication. main (CloudGatewayApplication.java:14) [classes /: na] Вызвано: java.io.FileNotFoundException: cl ресурс заданного пути [org / springframework / boot / autoconfigure / web / ServerPropertiesAutoConfiguration.class] не может быть открыт, потому что он не существует в org.springframework.core.io.ClassPathResource.getInputStream (ClassPathResource.java:180) ~ [spring-core -5.3.2.jar: 5.3.2] в org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader (SimpleMetadataReader.java:55) ~ [spring-core-5.3.2.jar: 5.3.2] в org .springframework.core.type.classreading.SimpleMetadataReader. (SimpleMetadataReader.java:49) ~ [spring-core-5.3.2.jar: 5.3.2] в org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader ( .java: 103) ~ [spring-core-5.3.2.jar: 5.3.2] в org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader (ConcurrentReferenceCachingMetadataReaderFactory 2.4.java:86) ~. 1.jar: 2.4.1] в org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.g etMetadataReader (ConcurrentReferenceCachingMetadataReaderFactory.java:73) ~ [spring-boot-2.4.1.jar: 2.4.1] в org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader (~ SimpleMetadataReaderFactory.getMetadataReader (~ SimpleMetadata springReader: coreFactory) [SimpleMetadata springReader: coreFactory] -5.3.2.jar: 5.3.2] в org.springframework.context.annotation.ConfigurationClassParser.asSourceClass (ConfigurationClassParser.java:696) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework .context.annotation.ConfigurationClassParser $ SourceClass.getRelated (ConfigurationClassParser.java:1090) ~ [spring-context-5. 3.2.jar: 5.3.2] в org.springframework.context.annotation.ConfigurationClassParser $ SourceClass.getAnnotationAttributes (ConfigurationClassParser.java:1071) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework. context.annotation.ConfigurationClassParser.collectImports (ConfigurationClassParser.java:549) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework.context.annotation.ConfigurationClassParser.getImports (ConfigurationClassParser.java:522) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass (ConfigurationClassParser.java:311) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass (ConfigurationClassParser.java:250) ~ [spring-context-5.3.2.jar: 5.3.2] в org.springframework.context.annotation.ConfigurationClassParser.processImports (ConfigurationClassParser.processImports. java: 600) ~ [spring-context-5.3.2.jar: 5.3.2] ... 20 общих фреймов опущены`package com.study.cloud.gateway;

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix</artifactId>
    <version>1.4.7.RELEASE</version>
</dependency>
person Devender Kumar    schedule 14.02.2021