Skip to content

4.3. Configuration Management

4.3.1. application.yml Structure

Use application.yml as the base configuration file, and separate profile-specific settings into application-{profile}.yml files.

src/main/resources/
├── application.yml             # Common settings
├── application-local.yml       # Local development
├── application-dev.yml         # Development server
├── application-staging.yml     # Staging
└── application-prod.yml        # Production

4.3.2. Common Configuration Example

yaml
spring:
  application:
    name: flowin-api
  profiles:
    active: local

  # Datasource common settings
  datasource:
    hikari:
      connection-timeout: 30000
      idle-timeout: 600000
      max-lifetime: 1800000
      leak-detection-threshold: 60000

  # jOOQ
  jooq:
    sql-dialect: postgres

  # Flyway
  flyway:
    enabled: true
    locations: classpath:db/migration
    validate-on-migrate: true

server:
  port: 8080
  servlet:
    context-path: /api

logging:
  level:
    root: INFO
    com.tienipia: DEBUG

Note

Datasource connection details (URL, username, password) and HikariCP pool-size settings are managed in profile-specific configuration files. Refer to the Database Standards documentation for details.

4.3.3. @ConfigurationProperties Usage

For custom configuration values, use @ConfigurationProperties instead of @Value to apply type-safe configuration binding.

java
@ConfigurationProperties(prefix = "app.storage")
public record StorageProperties(
    String uploadPath,
    long maxFileSize,
    List<String> allowedExtensions
) {}
yaml
app:
  storage:
    upload-path: /data/uploads
    max-file-size: 10485760
    allowed-extensions:
      - pdf
      - png
      - jpg

TIENIPIA QUALIFIED STANDARD