Java 11493 (#12349)

* moved spring-cloud-bus (submodule) to spring-cloud-modules (parent)

* moved spring-cloud-cli (submodule) to spring-cloud-modules (parent)

* moved spring-cloud-data-flow (submodule) to spring-cloud-modules (parent)

* moved spring-sleuth (submodule) to spring-cloud-modules (parent)

* Deleted submodules that we moved to  spring-cloud-modules

* deleted old modules from parent pom

Co-authored-by: panagiotiskakos <panagiotis.kakos@libra-is.com>
This commit is contained in:
panos-kakos
2022-06-15 19:00:49 +01:00
committed by GitHub
parent cd1a8c8fe4
commit 9be62e0311
90 changed files with 246 additions and 222 deletions
@@ -0,0 +1,32 @@
package com.baeldung;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
@RefreshScope
public class SpringCloudConfigClientApplication {
@Value("${user.role}")
private String role;
@Value("${user.password}")
private String password;
public static void main(String[] args) {
SpringApplication.run(SpringCloudConfigClientApplication.class, args);
}
@RequestMapping(value = "/whoami/{username}", method = RequestMethod.GET, 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,27 @@
---
spring:
application:
name: config-client
profiles:
active: development
config:
import: configserver:http://root:s3cr3t@localhost:8888
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
cloud:
bus:
enabled: true
refresh:
enabled: true
config:
fail-fast: true
management:
endpoints:
web:
exposure:
include: "*"
security:
enabled: false
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>
@@ -0,0 +1,33 @@
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.SpringCloudConfigClientApplication;
/**
* This LiveTest requires:
* 1- The 'spring-cloud-bus/spring-cloud-config-server' service running, with valid Spring Cloud Config properties, for instance:
* 1.1- `spring.cloud.config.server.git.uri` pointing to a valid URI, which has `user.role` and `user.password` properties configured in a properties file. For example, to achieve this in a dev environment:
* 1.1.1- `cd my/custom/path`
* 1.1.2- `git init .`
* 1.1.3- `echo user.role=Programmer >> application.properties`
* 1.1.4- `echo user.password=d3v3L >> application.properties`
* 1.1.5- `git add .`
* 1.1.6- `git commit -m 'inital commit'`
* 1.1.7- 'spring-cloud-bus/spring-cloud-config-server' with property `spring.cloud.config.server.git.uri=my/custom/path`
*
* Note: This is enough to run the ContextTest successfully, but to get the full functionality shown in the related article, we'll need also a RabbitMQ instance running (e.g. `docker run -d --hostname my-rabbit --name some-rabbit -p 15672:15672 -p 5672:5672 rabbitmq:3-management`)
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringCloudConfigClientApplication.class)
public class SpringContextLiveTest {
@Test
public void contextLoads() {
}
}