2017-01-26 7 views
0

검색 및 구성 서버용 총재를 탐색 중입니다. 필요한 종속성을 추가했고 yml 파일이 설정되었습니다. 내가 봄 클라우 (봄 실행.)를 사용하여 서버를 시작하려고하면 해결할 수없는 아래의 오류가 나타납니다. 어떤 도움을 주셔서 감사합니다.Spring 클라우드 cli를 통해 Groovy 앱을 시작하는 동안 Spring Cloud Consul 구성과 관련된 문제

오류 : ". 구성 요소가> 찾을 수 없습니다 'configServerRetryInterceptor'라는 이름의 빈을 요구" 가

이 콩을 정의하려했지만 스프링 클라우드 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 

답변

1

아래의 코드를 참조하십시오. 스프링 클라우드 구성 및 스프링 클라우드 검색을 명시 적으로 비활성화하면 해결됩니다.

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