SOFTMOA TECHNOLOGY

Spring Boot 3.4 SSL 인증서 모니터링과 Graceful Shutdown 설정 가이드

소프트모아가 정리한 기술 기록입니다.

Contents
작성일 2026. 04. 10.

Spring Boot 3.4 주요 변경사항

Spring Boot 3.4는 SSL 인증서 모니터링, Graceful Shutdown 기본 활성화, Actuator 엔드포인트 확장성 개선 등 운영 환경에 중요한 기능들이 추가되었습니다.

SSL 인증서 모니터링

프로덕션 환경에서 SSL 인증서 만료는 심각한 장애를 유발합니다. Spring Boot 3.4는 인증서 상태를 자동으로 모니터링합니다.

설정 방법

# application.yml
server:
  ssl:
    key-store: classpath:keystore.p12
    key-store-password: ${SSL_PASSWORD}
    key-store-type: PKCS12

management:
  endpoints:
    web:
      exposure:
        include: health,info
  endpoint:
    health:
      show-details: always
  health:
    ssl:
      enabled: true
      # 만료 30일 전부터 경고
      certificate-validity-warning-threshold: 30d

Actuator /info 엔드포인트에서 SSL 정보 확인

// GET /actuator/info 응답 예시
{
  "ssl": {
    "bundles": {
      "server": {
        "certificateChain": [{
          "subject": "CN=example.com",
          "issuer": "CN=Let's Encrypt Authority",
          "serialNumber": "03:a1:...",
          "validityStarts": "2026-01-15T00:00:00Z",
          "validityEnds": "2026-07-15T00:00:00Z",
          "status": "VALID"
        }]
      }
    }
  }
}

Health Check 연동

// GET /actuator/health 응답 (인증서 만료 임박 시)
{
  "status": "OUT_OF_SERVICE",
  "components": {
    "ssl": {
      "status": "OUT_OF_SERVICE",
      "details": {
        "server": {
          "status": "OUT_OF_SERVICE",
          "details": {
            "expiresIn": "15 days",
            "validUntil": "2026-04-26T00:00:00Z"
          }
        }
      }
    }
  }
}

Graceful Shutdown 기본 활성화

Spring Boot 3.4부터 Graceful Shutdown이 기본으로 활성화됩니다. 서버 종료 시 진행 중인 요청을 완료한 뒤 종료합니다.

# application.yml - 기본값이 graceful로 변경됨
server:
  shutdown: graceful  # 기본값 (이전 버전은 immediate)

spring:
  lifecycle:
    timeout-per-shutdown-phase: 30s  # 대기 시간 (기본 30초)

Graceful Shutdown 동작 확인 코드

@RestController
public class SlowController {

    @GetMapping("/slow")
    public String slow() throws InterruptedException {
        // 10초 걸리는 작업 시뮬레이션
        Thread.sleep(10000);
        return "완료";
    }
}

// SIGTERM 수신 시:
// 1. 새 요청 수신 중단
// 2. 진행 중인 /slow 요청 완료 대기 (최대 30초)
// 3. 모든 요청 완료 후 서버 종료

Actuator 엔드포인트 확장

EndpointExposureOutcomeContributor 인터페이스로 커스텀 엔드포인트 노출 조건을 정의할 수 있습니다.

@Component
public class InternalOnlyEndpointContributor
        implements EndpointExposureOutcomeContributor {

    @Override
    public EndpointExposureOutcome getExposureOutcome(
            String endpointId,
            EndpointExposure exposure) {

        // 특정 엔드포인트는 내부 네트워크에서만 노출
        if ("env".equals(endpointId) || "configprops".equals(endpointId)) {
            if (exposure == EndpointExposure.WEB) {
                return EndpointExposureOutcome.DISALLOWED;
            }
        }
        return EndpointExposureOutcome.NEUTRAL;
    }
}

핵심 정리

  • SSL 인증서 자동 모니터링으로 만료 사전 감지
  • Graceful Shutdown이 기본 활성화되어 무중단 배포 안정성 향상
  • Actuator 확장 인터페이스로 엔드포인트 노출 세밀 제어
  • Liquibase Customizer, JCache 속성 커스터마이징 지원
Share this

Spring

Have a questions?

견적 및 기술문의

mobile : 010-7931-4813

Contact Form