From a60e242e29c0a52aee5da3de0249041479c2fe2f Mon Sep 17 00:00:00 2001 From: "woo-jin.shin" Date: Sun, 22 Aug 2021 17:43:52 +0900 Subject: [PATCH] Add properties --- receiver/build.gradle | 5 +++-- .../client/ProcessorAPIWebClient.java | 22 +++++++++++++++++++ .../resources/application-development.yml | 6 +++++ .../main/resources/application-production.yml | 6 +++++ receiver/src/main/resources/application.yml | 10 +++++++++ .../support/util/NumberUtil.java | 7 ++++++ .../support/util/ObjectUtil.java | 7 ++++++ .../support/webclient/WebClientBaseScan.java | 4 ++++ .../main/resources/development/webclient.yml | 5 +++++ .../main/resources/production/webclient.yml | 4 ++++ 10 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 receiver/src/main/java/com/myoa/engineering/music/soundhoundfound/receiver/infrastructure/client/ProcessorAPIWebClient.java create mode 100644 receiver/src/main/resources/application-development.yml create mode 100644 receiver/src/main/resources/application-production.yml create mode 100644 support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/NumberUtil.java create mode 100644 support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/ObjectUtil.java create mode 100644 support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/webclient/WebClientBaseScan.java create mode 100644 support/src/main/resources/development/webclient.yml create mode 100644 support/src/main/resources/production/webclient.yml diff --git a/receiver/build.gradle b/receiver/build.gradle index e7f48a3..a586bb2 100644 --- a/receiver/build.gradle +++ b/receiver/build.gradle @@ -4,14 +4,15 @@ dependencies { runtimeOnly 'mysql:mysql-connector-java' compileOnly 'org.projectlombok:lombok' - implementation 'org.springframework.boot:spring-boot-starter-web' + implementation project(':support') + // https://projectreactor.io/docs/core/release/reference/#debug-activate + implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.telegram:telegrambots:5.3.0' annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' - } test { diff --git a/receiver/src/main/java/com/myoa/engineering/music/soundhoundfound/receiver/infrastructure/client/ProcessorAPIWebClient.java b/receiver/src/main/java/com/myoa/engineering/music/soundhoundfound/receiver/infrastructure/client/ProcessorAPIWebClient.java new file mode 100644 index 0000000..48b9f86 --- /dev/null +++ b/receiver/src/main/java/com/myoa/engineering/music/soundhoundfound/receiver/infrastructure/client/ProcessorAPIWebClient.java @@ -0,0 +1,22 @@ +package com.myoa.engineering.music.soundhoundfound.receiver.infrastructure.client; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.client.WebClient; + +import java.util.List; + +@Component +public class ProcessorAPIWebClient { + + + @Value("${webclient.some}") + private String baseUrl; + + private final WebClient webClient; + + public ProcessorAPIWebClient(WebClient.Builder webClientBuilder) { + this.webClient = webClientBuilder.baseUrl("soundhoundfound-processor:20080") + .build(); + } +} \ No newline at end of file diff --git a/receiver/src/main/resources/application-development.yml b/receiver/src/main/resources/application-development.yml new file mode 100644 index 0000000..7df42f3 --- /dev/null +++ b/receiver/src/main/resources/application-development.yml @@ -0,0 +1,6 @@ +spring: + config: + activate: + on-profile: development + import: + - classpath:/development/webclient.yml \ No newline at end of file diff --git a/receiver/src/main/resources/application-production.yml b/receiver/src/main/resources/application-production.yml new file mode 100644 index 0000000..7c1069c --- /dev/null +++ b/receiver/src/main/resources/application-production.yml @@ -0,0 +1,6 @@ +spring: + config: + activate: + on-profile: production + import: + - classpath:/production/webclient.yml \ No newline at end of file diff --git a/receiver/src/main/resources/application.yml b/receiver/src/main/resources/application.yml index e69de29..2a8e30d 100644 --- a/receiver/src/main/resources/application.yml +++ b/receiver/src/main/resources/application.yml @@ -0,0 +1,10 @@ +spring: + main: + allow-bean-definition-overriding: true + profiles: + active: development + freemarker: + enabled: false + +webclient: + some: not-test \ No newline at end of file diff --git a/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/NumberUtil.java b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/NumberUtil.java new file mode 100644 index 0000000..c4f67d1 --- /dev/null +++ b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/NumberUtil.java @@ -0,0 +1,7 @@ +package com.myoa.engineering.music.soundhoundfound.support.util; + +public final class NumberUtil { + + private NumberUtil() {} + +} diff --git a/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/ObjectUtil.java b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/ObjectUtil.java new file mode 100644 index 0000000..42d7b63 --- /dev/null +++ b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/util/ObjectUtil.java @@ -0,0 +1,7 @@ +package com.myoa.engineering.music.soundhoundfound.support.util; + +public final class ObjectUtil { + + private ObjectUtil() {} + +} diff --git a/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/webclient/WebClientBaseScan.java b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/webclient/WebClientBaseScan.java new file mode 100644 index 0000000..ab4e564 --- /dev/null +++ b/support/src/main/java/com/myoa/engineering/music/soundhoundfound/support/webclient/WebClientBaseScan.java @@ -0,0 +1,4 @@ +package com.myoa.engineering.music.soundhoundfound.support.webclient; + +public interface WebClientBaseScan { +} diff --git a/support/src/main/resources/development/webclient.yml b/support/src/main/resources/development/webclient.yml new file mode 100644 index 0000000..dc5e59f --- /dev/null +++ b/support/src/main/resources/development/webclient.yml @@ -0,0 +1,5 @@ +webclient: + some: test + units: + - unit-name: processor-api + base-url: http://localhost:20081 \ No newline at end of file diff --git a/support/src/main/resources/production/webclient.yml b/support/src/main/resources/production/webclient.yml new file mode 100644 index 0000000..4bb1d1d --- /dev/null +++ b/support/src/main/resources/production/webclient.yml @@ -0,0 +1,4 @@ +webclient: + units: + - unit-name: processor-api + base-url: http://soundhoundfound-processor:20080 \ No newline at end of file