Skip to content

Allow DevTools to load optional config file for local development overrides #46609

@asaikali

Description

@asaikali

Introduce support in Spring Boot DevTools to automatically and optionally load a application-devtools.yml (or .properties) file as a local override configuration source during development.

Motivation
When developing Spring Boot applications, it is common to need local-only configuration such as:

  • Local service endpoints or ports
  • Developer-specific API keys or credentials
  • Debug or logging tweaks
  • Feature toggles or secrets

Currently, developers must choose between:

  • Creating profile-specific overrides (e.g., application-dev.yml) but there is no standard convention for what this file is called, so every project does something different, making it a bespoke effort to configure locally runnable boot app.
  • Using spring.config.import in application.yml, which adds complexity and clutter to the main configuration, and may accidentally leak dev-only paths into production environments.

Proposed Behavior
If DevTools is present on the classpath, Spring Boot would automatically and optionally import a config file named:

application-devtools.yml

(or .properties), if it exists in the same ___location(s) as the other config files (e.g., src/main/resources, or external locations).

  • It would not require any spring.config.import entry.
  • It would be gracefully ignored if not present.
  • Developers can .gitignore it by default:
    application-devtools.yml
  • IDEs and CLI builds using DevTools (bootRun) would pick it up transparently.

Benefits

  • Safer and cleaner than custom spring.config.import hacks.
  • Avoids bloating application.yml with dev-only logic.
  • Encourages best practices: local config override without leaking to production.
  • Improves parity with how spring-boot-devtools already supports dev-only beans and runtime behavior.

Thanks for considering this enhancement! It would make DevTools even more useful and offer a convention that makes all spring boot developers lives easier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions