How do you manage configuration changes in your application when deploying to different environments?

Managing configuration across environments means externalizing environment-specific values from the application code, so the same build artifact can run correctly in dev, staging, and production without modification.

Key Points

Example

The same application JAR is deployed to staging and production, but application-staging.yml points to a staging database while application-prod.yml points to the production one, selected purely by setting SPRING_PROFILES_ACTIVE at deploy time.

# application-prod.yml
spring:
  datasource:
    url: jdbc:mysql://prod-db:3306/app
    username: ${DB_USER}
    password: ${DB_PASSWORD}

Interview Tip

A concise interview answer is

I externalize configuration using Spring profiles like application-dev.yml and application-prod.yml, combined with environment variables or Kubernetes ConfigMaps injected at deploy time. That way the exact same build artifact is promoted through every environment, with only its config changing.

Last updated: 16 July 2026

Previous question: Explain the importance of health checks in deployment and how you would implement them.

Next question: You are deploying to a cloud environment for the first time. What considerations should you keep in mind?

More Deployments interview questions

All Deployments questions