Skip to content

Instantly share code, notes, and snippets.

@marcusvieira88
Last active October 27, 2019 19:34
Show Gist options
  • Save marcusvieira88/cca0920f1792f2fe1d52889e3d00ec46 to your computer and use it in GitHub Desktop.
Save marcusvieira88/cca0920f1792f2fe1d52889e3d00ec46 to your computer and use it in GitHub Desktop.
Spring Cloud Config Client ConfigController.java
package tech.marcusvieira.springconfigmicroservice.controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.marcusvieira.springconfigmicroservice.configs.Configuration;
import tech.marcusvieira.springconfigmicroservice.resource.ConfigResource;
@RestController
public class ConfigController {
@Autowired
private Configuration configuration;
@GetMapping(name = "/configs")
public ConfigResource getConfigs() {
return new ConfigResource(configuration.getConfigA(), configuration.getConfigB());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment