From 4c91e89470436c35a13c38b6f73b115fa555d985 Mon Sep 17 00:00:00 2001 From: bjkim Date: Tue, 2 Sep 2025 16:39:39 +0900 Subject: [PATCH] =?UTF-8?q?[ADD]=20webflux=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 5 ++- .../etri/autoflow/common/WebClientConfig.java | 34 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/main/java/kr/re/etri/autoflow/common/WebClientConfig.java diff --git a/build.gradle.kts b/build.gradle.kts index 180df4b..7997bb2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -43,7 +43,9 @@ dependencies { // MariaDB 드라이버 runtimeOnly("org.mariadb.jdbc:mariadb-java-client:3.1.4") - // Lombok (선택) + implementation("org.springframework.boot:spring-boot-starter-webflux") + + // compileOnly("org.projectlombok:lombok:1.18.38") annotationProcessor("org.projectlombok:lombok:1.18.38") testCompileOnly("org.projectlombok:lombok:1.18.38") @@ -52,6 +54,7 @@ dependencies { // 테스트 testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation("org.springframework.security:spring-security-test") + } // Java 컴파일 인코딩 및 파라미터 리플렉션 지원 diff --git a/src/main/java/kr/re/etri/autoflow/common/WebClientConfig.java b/src/main/java/kr/re/etri/autoflow/common/WebClientConfig.java new file mode 100644 index 0000000..dcc3b3e --- /dev/null +++ b/src/main/java/kr/re/etri/autoflow/common/WebClientConfig.java @@ -0,0 +1,34 @@ +package kr.re.etri.autoflow.common; + +import io.netty.handler.ssl.SslContextBuilder; +import io.netty.handler.ssl.util.InsecureTrustManagerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.reactive.ReactorClientHttpConnector; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.netty.http.client.HttpClient; + +import javax.net.ssl.SSLException; + +@Configuration +public class WebClientConfig { + + @Bean + public WebClient webClient(WebClient.Builder builder) throws Exception { + HttpClient httpClient = HttpClient.create() + .secure(ssl -> { + try { + ssl.sslContext( + SslContextBuilder.forClient() + .trustManager(InsecureTrustManagerFactory.INSTANCE).build() // SSL 검증 무시 + ); + } catch (SSLException e) { + throw new RuntimeException(e); + } + }); + + return builder + .clientConnector(new ReactorClientHttpConnector(httpClient)) + .build(); + } +}