Проблемы с конфигурацией Spring Cloud Consul при запуске приложения Groovy через Spring Cloud cli

Я изучаю Consul для обнаружения и настройки сервера. Я добавил необходимые зависимости, и файл yml настроен. Когда я пытаюсь запустить сервер с помощью Spring Cloud cli (Spring run). Я получаю следующую ошибку, которую не могу устранить. Любая помощь приветствуется.

Ошибка: «Компоненту требуется bean-компонент с именем« configServerRetryInterceptor », который не может быть найден».

Я пытался определить этот компонент, но когда я запускаю приложение через Spring Cloud cli, он не распознает его.

Пожалуйста, смотрите код ниже

App.groovy

@Grab("spring-cloud-starter-consul-config")
@Grab("spring-cloud-starter-consul-discovery")

@EnableDiscoveryClient
@EnableCircuitBreaker
@RestController
@Log
class Application{

@Autowired
Greeter greeter

int counter = 0

@RequestMapping(value = "/counter", produces = "application/json")
String produce() {
    counter++
    log.info("Produced a value: ${counter}")

    "{\"value\": ${counter}}"
}

@RequestMapping("/")
String home() {
    "${greeter.greeting} World!"
}

@RequestMapping(value = '/questions/{questionId}')
@HystrixCommand(fallbackMethod = "defaultQuestion")
def question(@PathVariable String questionId) {
    if(Math.random() < 0.5) {
        throw new RuntimeException('random');
    }
    [questionId: questionId]
}

def defaultQuestion(String questionId) {
   [questionId: 'defaultQuestion']
}

}

@Component
@RefreshScope
class Greeter {
@Value('${greeting}')
String greeting
}

bootstrap.yml

consul:
  host: localhost
  port: 8500
  config:
    enabled: true
    prefix: config
    defaultContext: master
    profileSeparator: '::'
    format: FILES
  discovery:
    instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
    health-check-url: http://127.0.0.1:${server.port}/health

person Muru    schedule 26.01.2017    source источник


Ответы (1)


Эта проблема возникла из-за нежелательных зависимостей. Явное отключение конфигурации весеннего облака и обнаружение весеннего облака исправило это.

spring:
  cloud:
    config:
      enabled: false
      discovery:
        enabled: false
        serviceId: CONFIG
eureka:
  client:
    register-with-eureka: false
    fetch-registry: false
person Muru    schedule 25.02.2017