hard-coding μ ν΅ν΄μ λͺ¨λ κ°λ€μ static νκ² app μ μ¬μ©νλ κ²μ λ§€μ° μ μ°νμ§ λͺ»νλ€. λ°λΌμ app μ configurable νκ² λ§λ€ νμκ° μλ€.
μ΄λ, application.properties νμΌμμ custom properties λ₯Ό μ μν μ μλ€. μ΄λ κ² λ§λ€μ΄μ§ properties λ€μ @Value annotation μ μ¬μ©νμ¬ app μμ ν΄λΉ λ°μ΄ν°λ₯Ό μ κ·Ό κ°λ₯νκ² λ§λ€ μ μλ€. μμ Application Properties μ λνμ¬ μ€λͺ
ν κ²μ²λΌ λ§μ΄λ€.
Spring Boot Properties
application.properties λ₯Ό ν΅νμ¬ Spring Boot μ€μ λ ꡬμ±ν μ μλ€. Server Port, Context Path, Actuator, Security λ±μ μ€μ ν μ μλ€.

λͺ¨λ Spring Boot Properties λ Spring Boot Properties λ¬Έμ μμ νμΈν μ μλλ°, 1000κ°κ° λκΈ° λλ¬Έμ property λ₯Ό μ νν¨μ μμ΄μ μ΄λ €μμ΄ μμ μ μλ€. κ·Έλ¬λ μμ κ°μ΄ 8κ°μ κ·Έλ£ΉμΌλ‘ rough νκ² λΆλ₯λμ΄ μκΈ° λλ¬Έμ, νμν κ·Έλ£Ήμ λνμ¬ λΆμνκ³ νμν property λ₯Ό μ ννλ©΄ λλ€.
μ¬λ¬κ°μ group μ€μμ λͺ κ°λ§ μ΄ν΄λ³΄μ.
Core Properties
# Log levels serverity mapping
logging.level.org.springframework=DEBUG
logging.level.org.hibernate=TRACE
logging.level.com.lucvs=INFO
# Log file name
logging.file.name=sample.log
logging.file.path=/sampleCore Properties μμλ Spring Boot μ μ€ν νκ²½, logging, message μ²λ¦¬, thread κ΄λ¦¬ λ± ν΅μ¬μ μΈ κΈ°λ₯μ ꡬμ±νλ λ°μ νμ©λλ€.
μλ₯Ό λ€μ΄ logging μ κ²½μ° logging level μ μμ κ°μ΄ μ§μ ν μ μλλ°, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF λ‘ νμν λͺ©μ μ λ°λΌ μ‘°μ ν μ μλ€. μ μ₯λλ log νμΌμ μ΄λ¦ λ° κ²½λ‘λ λͺ
μμ μΌλ‘ μ§μ ν μ μλ€.
Web Properties
# HTTP server port
server.port=7070
# Context path of the application
server.servlet.context-path=/sample
# Default HTTP session time out
server.servlet.session.timeout=15mWeb Properties μμλ web application κ³Ό κ΄λ ¨λ μ€μ μ λ΄λΉνλ€.
μλ₯Ό λ€μ΄, μμ κ°μ΄ server μ port λ²νΈλ₯Ό μ§μ νκ±°λ, Context Path λ₯Ό λͺ μμ μΌλ‘ λ³κ²½νκ±°λ, session μ timeout μκ°μ default μΈ 30λΆμμ μνλ μκ°μΌλ‘ λ°κΏ μ μλ€.
Actuator Properties
# Endpoints to include by name or wildcard
management.endpoints.web.exposure.include=*
# Endpoints to exclude by name or wildcard
management.endpoints.web.exposure.include=health,info
# Base path for actuator endpoints
management.endpoints.web.base-path=/actuatorActuator Properties μμλ Accessing Endpoints λΆλΆμμ λ³Έ κ²μ²λΌ, endpoints λ₯Ό μΆκ° λ° μ μΈνκ±°λ Actuator endpoints μ base path λ₯Ό μ§μ ν μ μλ€.
Security Properties
# Default user name
spring.security.user.name=admin
# Password for default user
spring.security.user.password=secretSecurity Properties μμλ κΈ°λ³Έ μΈμ¦ μ€μ μ΄λ CSRF λ³΄νΈ νμ±ν λ±μ κΈ°λ₯μ μ€μ ν μ μλ€. μμ μμμμλ default μ¬μ©μμ μ΄λ¦μ΄λ λΉλ°λ²νΈλ₯Ό μ€μ ν μ μλ€λ κ²μ 보μ¬μ€λ€. κ·Έλ¬λ μ΄λ μμ£Ό κΈ°λ³Έμ μΈ μ€μ λ§ μ 곡νκΈ° λλ¬Έμ μ€μ publication λ¨κ³μμλ μ¬μ©μ μ§μνλ κ²μ΄ λ°λμ§νλ€.
μ΄μ λ¨μν properties μμ λΉλ°λ²νΈλ§ μ€μ νλ κ²μ΄ μλλΌ, λ λμκ° DB λ₯Ό μ¬μ©νμ¬ security info λ₯Ό νμΈνμ¬ μ¬μ©μ μΈμ¦μ μ§ννλ λ°©λ², μνΈνλ λΉλ°λ²νΈλ₯Ό μ¬μ©νλ λ°©λ² λ± λ κ³ λνλ 보μ μ λ΅μ μ¬μ©ν μ μλ€.
Data Properties
# JDBC URL of the database
spring.datasource.url=jdbc:mysql://localhost:3306/mydb
# Login username of the database
spring.datasource.username=scott
# Login password of the database
spring.datasource.password=tigerData Properties μμλ Database μ°κ²° λ° λ°μ΄ν° μ²λ¦¬μ κ΄λ ¨λ μ€μ κ³Ό κ΄λ ¨λμ΄ μλ€.
Etcetra
μ΄μΈμλ, Integration Properties λ messaging μ΄λ μΈλΆ μμ€ν κ³Όμ ν΅ν©μ μν κΈ°λ₯, Devtools Properties λ κ°λ° νκ²½μμ νΈλ¦¬ν κΈ°λ₯μ μ 곡νλ κΈ°λ₯, Testing Properties λ ν μ€νΈ νκ²½μμ μ¬μ©νλ κΈ°λ₯μ λ΄λΉνλ€.