From eb2cce8002a09a42a7a19ccafbfb3dc7463b07d2 Mon Sep 17 00:00:00 2001 From: Rinjae Date: Wed, 12 Aug 2026 11:48:37 +0900 Subject: [PATCH] =?UTF-8?q?Actuator/SBA=20=EB=A1=9C=EC=BB=AC=20=EC=A0=9C?= =?UTF-8?q?=ED=95=9C=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80:=20-=20appl?= =?UTF-8?q?ication.yml=20=EC=A3=BC=EC=84=9D=20=EB=B0=8F=20build.gradle=20?= =?UTF-8?q?=EB=A1=9C=EC=BB=AC=20=EC=A0=84=EC=9A=A9=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=B2=98=EB=A6=AC=20-=20?= =?UTF-8?q?=EB=B0=B0=ED=8F=AC=20=EC=82=B0=EC=B6=9C=EB=AC=BC=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=A1=9C=EC=BB=AC=20=EC=A0=84=EC=9A=A9=20=EB=A6=AC?= =?UTF-8?q?=EC=86=8C=EC=8A=A4/=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC?= =?UTF-8?q?=EB=A6=AC=20=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 43 ++++++++++++++++++++++++++++++ src/main/resources/application.yml | 5 ++++ 2 files changed, 48 insertions(+) diff --git a/build.gradle b/build.gradle index 9f0d744..683c7e0 100644 --- a/build.gradle +++ b/build.gradle @@ -24,6 +24,24 @@ allprojects { } } +// 로컬 전용 라이브러리 — WebLogic 배포 산출물(war/bootWar)에서 제외한다. +// 정보보호 점검에서 Actuator/모니터링 라이브러리가 배포본에 실려 있으면 불필요하게 탐지되므로 +// 로컬(bootRun/IDE)에서만 classpath 에 오르게 한다. 제외 로직은 아래 war/bootWar 블록. +// +// ※ Spring Boot 의 developmentOnly 를 쓰지 않는 이유 +// developmentOnly 는 bootJar/bootWar 에서만 제외된다. 표준 war task 는 runtimeClasspath 를 +// 그대로 쓰므로 산출물에 실린다 (실측: devtools 가 eapim-portal.war 에 포함되어 있었음). +// ※ 별도 configuration(localOnly)을 쓰지 않는 이유 +// runtimeClasspath 에서 빠지면 IntelliJ 가 모듈 classpath 를 구성할 때도 빠져 +// IDE 로 기동할 때 Actuator/SBA 가 동작하지 않는다. +def localOnlyLibPrefixes = [ + 'spring-boot-devtools', + 'spring-boot-starter-actuator', + 'spring-boot-actuator', // spring-boot-actuator, -autoconfigure 모두 매칭 + 'micrometer-', // actuator 전용(runtimeClasspath 상 다른 출처 없음 — 확인함) + 'spring-boot-admin-', +] + dependencies { annotationProcessor "org.projectlombok:lombok:1.18.28" annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0", "org.mapstruct:mapstruct-processor:1.5.5.Final" @@ -45,6 +63,17 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-jta-atomikos' implementation('org.springframework.boot:spring-boot-starter-web') implementation('org.springframework.boot:spring-boot-starter-validation') + + // ↓ 로컬 전용. war/bootWar 산출물에서는 localOnlyLibPrefixes 로 제외된다. + // runtimeOnly 인 이유: compileClasspath 에서 빠지므로 자바 코드가 이 API 를 참조하면 + // 컴파일 단계에서 막힌다. implementation 이면 참조가 컴파일에 통과해버리고, + // 배포본(actuator/SBA 제외됨)에서 NoClassDefFoundError 로 터진다. + // IntelliJ / bootRun 은 runtimeClasspath 기준이라 로컬 기동에는 정상 포함된다. + // 설정(application-local*.yml)으로만 사용한다. + runtimeOnly('org.springframework.boot:spring-boot-starter-actuator') + // Spring Boot Admin client. 2.7.16 = Spring Boot 2.7.x 대응 마지막 계열(Java 8 호환). + runtimeOnly('de.codecentric:spring-boot-admin-starter-client:2.7.16') + implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0' implementation group: 'com.fasterxml.woodstox', name: 'woodstox-core', version: '6.5.1' @@ -190,9 +219,21 @@ test { enabled = true } +// 로컬 전용 설정 파일. 배포 산출물(WAR)에 실리면 Actuator/SBA 설정이 그대로 노출되어 +// 정보보호 점검에 불필요하게 걸린다. processResources 는 건드리지 않는다 +// (bootRun 이 build/resources/main 을 그대로 쓰므로 로컬 기동이 깨진다). +def localOnlyResources = ['**/application-local*.yml'] + +// 배포 산출물에서 로컬 전용 라이브러리를 걸러낸다. localOnlyLibPrefixes 는 파일 상단 정의. +def excludeLocalOnlyLibs = { org.gradle.api.file.FileCollection cp -> + cp.filter { f -> !localOnlyLibPrefixes.any { p -> f.name.startsWith(p) } } +} + bootWar { archiveFileName = "eapim-portal-boot.war" mainClass = 'com.eactive.apim.portal.PortalApplication' + rootSpec.exclude(localOnlyResources) + classpath = excludeLocalOnlyLibs(classpath) } war { @@ -201,6 +242,8 @@ war { from('src/main/resources/jeus-web-dd.xml') { into 'WEB-INF' } from('src/main/resources/weblogic.xml') { into 'WEB-INF' } + rootSpec.exclude(localOnlyResources) + classpath = excludeLocalOnlyLibs(classpath) } task printSourceSets { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index dd2d8cd..ec05031 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -91,6 +91,11 @@ security: basic: enabled: false +# ※ Actuator / Spring Boot Admin 설정은 이 파일에 두지 않는다. +# application-local*.yml 에만 두고, 해당 파일과 관련 라이브러리는 war/bootWar 산출물에서 +# 제외된다(build.gradle 의 localOnly configuration + rootSpec.exclude 참고). +# WebLogic 배포본(dev/stage/prod)에는 actuator 자체가 존재하지 않는다. + sample-code-path: classpath:/templates/sample_code