JAVA-11240 Moved spring-cloud to spring-cloud-modules

This commit is contained in:
Dhawal Kapil
2022-05-29 19:32:17 +05:30
parent a7cae2e766
commit 85d134952e
934 changed files with 35 additions and 230 deletions
@@ -0,0 +1,28 @@
package com.baeldung.spring.cloud.config.client;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class ConfigClient {
@Value("${user.role}")
private String role;
@Value("${user.password}")
private String password;
public static void main(String[] args) {
SpringApplication.run(ConfigClient.class, args);
}
@GetMapping(value = "/whoami/{username}", produces = MediaType.TEXT_PLAIN_VALUE)
public String whoami(@PathVariable("username") String username) {
return String.format("Hello %s! You are a(n) %s and your password is '%s'.\n", username, role, password);
}
}
@@ -0,0 +1,3 @@
spring.application.name=config-client
spring.profiles.active=development
spring.config.import=optional:configserver:http://root:s3cr3t@localhost:8888
@@ -0,0 +1,21 @@
package com.baeldung.spring.cloud.config.client;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
/**
*
* The app needs the server running on port 8888. Can be started with docker
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ConfigClient.class)
@WebAppConfiguration
public class SpringContextLiveTest {
@Test
public void contextLoads() {
}
}