This project uses profile-based YAML configuration. Only application-example.yml is committed to git to keep credentials secure.
Copy the example configuration file to create your actual configuration files:
# Copy base configuration
cp src/main/resources/application-example.yml src/main/resources/application.yml
# Copy development configuration
cp src/main/resources/application-example.yml src/main/resources/application-dev.yml
# Copy production configuration
cp src/main/resources/application-example.yml src/main/resources/application-prod.ymlEdit src/main/resources/application-dev.yml and update the database password:
spring:
datasource:
password: ${DB_PASSWORD:your_actual_password_here}Note: These files are already in .gitignore and will not be committed to git.
For production deployments, edit src/main/resources/application-prod.yml and ensure all environment variables are properly configured. Never commit real production credentials.
- ✅
application-example.yml- Template file (committed to git) - ❌
application.yml- Base configuration (gitignored) - ❌
application-dev.yml- Development configuration (gitignored) - ❌
application-prod.yml- Production configuration (gitignored)
After creating the configuration files:
- Set your database password in
application-dev.yml(or use environment variable) - Run the application:
./mvnw spring-boot:run
The application will use the dev profile by default.
You can also use environment variables instead of hardcoding values:
export DB_PASSWORD=your_password
export MONGODB_URI=mongodb://localhost:27017/order_platform
./mvnw spring-boot:runEnvironment variables take precedence over values in YAML files.
⚠️ Never commit actual configuration files to git⚠️ Onlyapplication-example.ymlshould be in version control⚠️ Keep your localapplication-dev.ymlsecure- ✅ The
.gitignorefile already excludes these files