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:
  servers: [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 -50% ํ• ์ธ์ฟ ํฐ: 15108-f2af1e086101 buy me a coffee