YAML

YAML vs. Properties

가독성

spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
spring.datasource.url=jdbc:log4jdbc:mariadb://localhost:3306/test?characterEncoding=UTF-8&serverTimezone=UTC
spring.datasource.hikari.username=root
spring.datasource.hikari.password=password
spring.datasource.hikari.maximum-pool-size=10
spring:
  datasource:
    driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
    url: jdbc:log4jdbc:mariadb://localhost:3306/test?characterEncoding=UTF-8&serverTimezone=UTC
    hikari:
      username: root
      password: password
      maximum-pool-size: 10

리스트

my.servers[0]=dev.example.com
my.servers[1]=another.example.com
my:
  servers:
    - dev.example.com
    - another.example.com
my:
  server: [dev.example.com, another.example.com]

주석

# comment
my:
  servers:
    - dev.example.com # 개발 서버
    - another.example.com # 예비 서버

스프링 Profile 적용

#local, dev, prod 공통 설정
application:
  version: 1.0.0
  title: app

spring:
  profiles:
    active: local #profiles 선언하여 적용할 profile을 선택 한다.

  thymeleaf:
    view-names: thymeleaf/*
    prefix: classpath:templates/
    suffix: .html
    cache: false

--- #local 환경
spring:
  profiles: local
logging:
  level:
    root: debug

--- #dev 환경
spring:
  profiles: local
logging:
  level:
    root: info

--- #prod 환경
spring:
  profiles: local
server:
  port: 9090
logging:
  level:
    root: error

Group

spring:
  profiles:
    group:
      - dev
      - qa

주의

acme.my-project.person.first-name

ref

What Else?
inflearn react api server