Spring Boot application.yml Prod/Dev Profil
Spring Boot multi-profile yapılandırması. Development ve production ortamları için ayrı ayarlar.
By Tolgahan
·
·
315 görüntülenme
# application.yml - Ortak ayarlar
spring:
application:
name: my-service
jackson:
serialization:
write-dates-as-timestamps: false
default-property-inclusion: non_null
server:
port: 8080
shutdown: graceful
management:
endpoints:
web:
exposure:
include: health,info,metrics
endpoint:
health:
show-details: when-authorized
---
# application-dev.yml - Development
spring:
config:
activate:
on-profile: dev
datasource:
url: jdbc:mysql://localhost:3306/myapp_dev
username: root
password: secret
jpa:
show-sql: true
hibernate:
ddl-auto: update
properties:
hibernate:
format_sql: true
data:
redis:
host: localhost
port: 6379
logging:
level:
com.example: DEBUG
org.hibernate.SQL: DEBUG
---
# application-prod.yml - Production
spring:
config:
activate:
on-profile: prod
datasource:
url: ${DATABASE_URL}
username: ${DATABASE_USERNAME}
password: ${DATABASE_PASSWORD}
hikari:
maximum-pool-size: 20
minimum-idle: 5
connection-timeout: 30000
jpa:
show-sql: false
hibernate:
ddl-auto: validate
properties:
hibernate:
generate_statistics: false
data:
redis:
host: ${REDIS_HOST}
port: ${REDIS_PORT:6379}
password: ${REDIS_PASSWORD}
logging:
level:
root: WARN
com.example: INFO
# application.yml - Ortak ayarlar
spring:
application:
name: my-service
jackson:
serialization:
write-dates-as-timestamps: false
default-property-inclusion: non_null
server:
port: 8080
shutdown: graceful
management:
endpoints:
web:
exposure:
include: health,info,metrics
endpoint:
health:
show-details: when-authorized
---
# application-dev.yml - Development
spring:
config:
activate:
on-profile: dev
datasource:
url: jdbc:mysql://localhost:3306/myapp_dev
username: root
password: secret
jpa:
show-sql: true
hibernate:
ddl-auto: update
properties:
hibernate:
format_sql: true
data:
redis:
host: localhost
port: 6379
logging:
level:
com.example: DEBUG
org.hibernate.SQL: DEBUG
---
# application-prod.yml - Production
spring:
config:
activate:
on-profile: prod
datasource:
url: ${DATABASE_URL}
username: ${DATABASE_USERNAME}
password: ${DATABASE_PASSWORD}
hikari:
maximum-pool-size: 20
minimum-idle: 5
connection-timeout: 30000
jpa:
show-sql: false
hibernate:
ddl-auto: validate
properties:
hibernate:
generate_statistics: false
data:
redis:
host: ${REDIS_HOST}
port: ${REDIS_PORT:6379}
password: ${REDIS_PASSWORD}
logging:
level:
root: WARN
com.example: INFO
AI Asistan
Sorularını yanıtlamaya hazır