spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
75k stars 40.66k forks source link

How to ensure client is connecting to Config server? #10427

Closed msathe-tech closed 7 years ago

msathe-tech commented 7 years ago

I've been able to standup a config server using a GIT repo. I can see the data pulled from the GIT repo from this URL - http://localhost:8080/trial1client/default/master

The config server and client files are available at following locations - Server POM - https://github.com/msathe-tech/trial1/blob/master/pom.xml Server application props - https://github.com/msathe-tech/trial1/blob/master/application.properties Config file in GIT - https://github.com/msathe-tech/trial1/blob/master/trial1client.properties Client POM - https://github.com/msathe-tech/trial1/blob/master/config-client_pom.xml Client bootstrap.properties - https://github.com/msathe-tech/trial1/blob/master/bootstrap.properties

Following is my client controller code - package com.trial;

import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;

@RestController public class MyController { @Value("${message:Hello default}") private String message;

@RequestMapping("/message")
String getMessage() {
    return this.message;
}

} I always see the default message, never the message in the GIT file. How can I ensure that client is connected to a config server?

I also noticed that despite adding all dependencies on the client POM I still can't use @RefreshScope. It simply doesn't show up. It can't find the class or package.

spencergibb commented 7 years ago

This is not the issue tracker for config server. Probably best to ask a question on stack overflow tagged with spring-cloud.

wilkinsona commented 7 years ago

Indeed. Thanks, @spencergibb.