I am working through a few tutorials for spring cloud and have hit a problem with my config client app. I have a Eureka server running on a Linux machine and on my Mac I have a config server which is registering correctly with the Eureka server. I generated a config client app using the spring initialiser. The dependencies I have are:
<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.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</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>
I have a bootstrap.properties file like this:
spring.application.name=config-client-app
spring.cloud.config.discovery.enabled=true
eureka.client.serviceUrl.defaultZone=http://192.168.1.125:8761/eureka/
When the config client app starts it fails to register with the Eureka server, as it is looking for an instance running on the local machine. If I put this in the application.properties then it does register with eureka but with the name UNKNOWN.
eureka.client.serviceUrl.defaultZone=http://192.168.1.125:8761/eureka/
From this it seems that the config client app is not using the bootstrap.properties file. From what I have read by having spring-cloud-starter-config on the classpath it should look for a bootstrap.properties file at startup.
The main application class has the following annotations.
@SpringBootApplication
@EnableDiscoveryClient
@RestController
What I am trying to achieve here is for the client to ask eureka for the location of the config server and then get it's config from there.
Thanks Andrew
bootstrap.propertiesare only valid for servers; the properties you listed should be placed in ordinary client'sapplication.properties. - k-wasilewski