2023/10/09 3

[Spring Boot] 2-6. Core Features: JSON

1. Jackson항목설명기본 제공Spring Boot는 spring-boot-starter-json을 통해 Jackson을 기본 JSON 직렬화 도구로 사용자동 설정Spring Boot의 Auto-Configuration에 의해 ObjectMapper가 자동 설정됨핵심 클래스ObjectMapper: 직렬화/역직렬화의 중심 클래스 Custom Serializers and Deserializers@JsonComponent항목설명정의커스텀 Serializer/Deserializer를 빈으로 자동 등록ObjectMapper에 등록됨특징내부 클래스 형태로 JsonSerializer, JsonDeserializer 구현 가능메타 정보@Component가 메타 어노테이션으로 포함되어 있음 예시) 커스텀 JsonS..

Spring/Spring Boot 2023.10.09

[Spring Boot] 2-3. Core Features: Profile

profile은 애플리케이션의 설정을 분리하여 특정 프로파일에 필요한 환경설정을 제공할 수 있습니다.@Profile 어노테이션을 통해 해당 클래스가 어떤 profile에 적용될지 가리킬 수 있습니다.어떤 프로파일을 활성화할지 명시할 수 있습니다.property : spring.profiles.active command line args : --spring.profiles.active 기본 프로파일을 명시할 수 있습니다.property : spring.profiles.default프로파일 활성화 조건을 명시할 수 있습니다.property : spring.config.activate.on-profile 1. Adding Active Profilesspring.profiles.active 프로퍼티는 Prope..

Spring/Spring Boot 2023.10.09

[Spring Boot] 2-2. Core Features: Externalized Configuration

1. Command Line Properties항목설명정의SpringApplication은 명령행 인자(Command Line Arguments)를 PropertySource로 변환해 Environment에 추가함우선순위매우 높음 → .properties, .yml, 환경 변수보다 우선 적용됨오버라이드 여부명령행 인자가 동일 키의 다른 설정들을 오버라이드함비활성화 방법SpringApplication.setAddCommandLineProperties(false)를 호출하면 Environment에 추가되지 않음$ java -jar app.jar --server.port=8085 2. JSON Application Properties항목설명정의JSON 문자열로 애플리케이션 설정을 주입하는 방식사용 키spri..

Spring/Spring Boot 2023.10.09