Skip to content

Instantly share code, notes, and snippets.

@andreybleme
Created August 16, 2019 02:09
Show Gist options
  • Save andreybleme/43b05d2db64e50dbaa0956fce088cdec to your computer and use it in GitHub Desktop.
Save andreybleme/43b05d2db64e50dbaa0956fce088cdec to your computer and use it in GitHub Desktop.
andreybleme.com | Centralized configuration with Spring Cloud Config
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RefreshScope
@RestController
class DatabaseController {
@Value("${url}")
private String postgresURL;
@RequestMapping("/database")
public String getDatabase() {
return this.postgresURL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment