I am Exploring Consul for discovery and config server. I have added the required dependencies and yml file is set up. When i try to start the server using spring cloud cli (Spring run .) I am getting the below error which i am unable to resolve. Any help is appreciated.
Error : "A component required a bean named 'configServerRetryInterceptor' that could >not be found."
I tried to define this bean but when i start the app through spring cloud cli it is not recognizing it.
Please see the code below
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