docs / guides/environment-variablesspringboot-cli

Environment variables ​

springboot-cli run optionally reads .env from the project root and passes those values to the Maven process that starts the application.

dotenv
SPRING_PROFILES_ACTIVE=local
DATABASE_URL="jdbc:postgresql://localhost:5432/catalog"
DATABASE_USER=app
DATABASE_PASSWORD=change-me

The parser accepts blank lines, # comments, optional export prefixes, and single- or double-quoted values. It does not expand references such as ${HOME}. Values from .env override variables with the same name already present in the shell environment for that run process.

Check required keys ​

Create .env.example with the keys your project expects, then create a local .env with your values:

dotenv
# .env.example
SPRING_PROFILES_ACTIVE=
DATABASE_URL=
DATABASE_USER=
DATABASE_PASSWORD=
bash
springboot-cli env sync

env sync reports keys present in .env.example but absent from .env. It checks for key presence only; it does not copy values, create either file, or check whether a value is empty. A .env.example file is required. Keep secrets in .env and out of version control.