0

I'm trying to set up some microservices with Spring Boot and Eureka. I'm using YAML configuration and when I start up the services, they are registered with the Eureka service. The problem I have is that the environment variables in my configuration files are not substituted but are interpreted as a string (see instanceId).

Example application.yml:

server:
  port: 0

eureka:
  instance:
    leaseRenewalIntervalSeconds: 10
    instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    registryFetchIntervalSeconds: 5

What I see on the Eureka app:

enter image description here

I've Googled the problem but I can't seem to find a solution. Does anybody known why this might happen or where I could start looking for solutions? I'm fairly new to this and I don't have a clue. Thanks.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Wouter C
  • 533
  • 1
  • 6
  • 21
  • 4
    I'm not sure if you able to use SPeL inside a `.yml` file, maybe you can, but I did notice you're missing a closing brace for the first opening brace on `instanceId`. – Jason White Dec 16 '17 at 12:01
  • 1
    @jmw5598 Oh man... I'm really that stupid. Appending a } to the line fixed the problem. I'm so sorry for this stupid question. Thank you for helping me! – Wouter C Dec 16 '17 at 12:10
  • happens to me all the time – Jason White Dec 16 '17 at 12:38

0 Answers0