- • Quickstart
- • Documentation
- • Documentation DevOps
- › Next Steps
- • Spring Boot
- • Spring Data
- • Spring Data MongoDB
- • Spring Security
- • Frontend
- • Multi-Module
Last updated: 2023-01-21
Configuring the database connection of your Spring Boot app
Did you know that you can save days or weeks of development time when starting new Spring Boot apps? br With Bootify you have the right helper at your side - get a runnable prototype in minutes and focus on your business logic instead. Best practices included.
In order to configure our database connection, we could simply edit the
application.yml. If there are already environment variables in place (the part before the first colon, e.g.
JDBC_DATABASE_URL), we don't need to change anything here. Otherwise we adjust the fallback behind the colon - whatever approach we prefer.
Adjusting our database connection
Using the local profile
If we don't want to commit our local database settings to the version control, there is also a nice way around it. In the run configuration in IntelliJ we already entered
-Dspring.profiles.active=local and thus the profile "local" is automatically active. Therefore we can also store our database settings in a new file
This file is automatically picked up by Spring Boot when the application starts with the corresponding profile. Since this file is listed in the
.gitignore, it is not added to git and can be edited separately by each developer. Instead we may add another file
application-local.example and add it to our repository, ready to be copied and customized.