diff --git a/eureka-first/pom.xml b/eureka-first/pom.xml index 3254b88..7613ccc 100644 --- a/eureka-first/pom.xml +++ b/eureka-first/pom.xml @@ -42,6 +42,10 @@ org.springframework.cloud spring-cloud-starter-config + + org.springframework.cloud + spring-cloud-starter-bootstrap + org.springframework.cloud spring-cloud-starter-netflix-eureka-client diff --git a/noweb/src/main/resources/application.yml b/noweb/src/main/resources/application.yml index 553b44a..1c717b1 100644 --- a/noweb/src/main/resources/application.yml +++ b/noweb/src/main/resources/application.yml @@ -1,6 +1,8 @@ spring: application: name: standalone + config: + import: "optional:configserver:" server: port: 7777 diff --git a/stream-bus/src/main/resources/application.yml b/stream-bus/src/main/resources/application.yml index 71eca6d..298ed60 100644 --- a/stream-bus/src/main/resources/application.yml +++ b/stream-bus/src/main/resources/application.yml @@ -4,8 +4,12 @@ spring: cloud: function: definition: you + config: + import: "optional:configserver:" --- spring: - profiles: other + config: + activate: + on-profile: other server: - port: 8081 \ No newline at end of file + port: 8081 diff --git a/stream-bus/src/test/java/demo/StreamBusApplicationTests.java b/stream-bus/src/test/java/demo/StreamBusApplicationTests.java index 6b8f6cf..08d3fb3 100644 --- a/stream-bus/src/test/java/demo/StreamBusApplicationTests.java +++ b/stream-bus/src/test/java/demo/StreamBusApplicationTests.java @@ -8,6 +8,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.bus.BusBridge; +import org.springframework.cloud.bus.event.Destination; import org.springframework.cloud.bus.event.RefreshRemoteApplicationEvent; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -27,9 +28,12 @@ public class StreamBusApplicationTests { @Autowired private MyListener myListener; + @Autowired + private Destination.Factory factory; + @Test - public void business() throws Exception { - RefreshRemoteApplicationEvent event = new RefreshRemoteApplicationEvent(this, "me", "you"); + public void business() { + RefreshRemoteApplicationEvent event = new RefreshRemoteApplicationEvent(this, "me", factory.getDestination("you")); this.bus.send(event); RefreshRemoteApplicationEvent event1 = myListener.refreshRemoteApplicationEvent; assertThat(event1).isEqualTo(event);