I have an application with maven as a build tool.
I am using maven profiles to set up different properties from different profiles.
What i would like to do i
For a Spring Boot application, one can add a property in the Maven profile in pom.xml and then reference that property in application.properties.
Add Maven profiles to pom.xml with, for example, a property called spring.profile.from.maven:
postgres
true
postgres
org.springframework.boot
spring-boot-starter-data-jpa
org.postgresql
postgresql
runtime
noDb
noDb
Reference the Maven property in application.properties:
spring.profiles.include=@spring.profile.from.maven@
With this setup, running maven with the postgres Maven profile or with no profile adds the postgres Spring profile to the list of Spring's active profiles, while running maven with the noDb Maven profile adds the noDb Spring profile to the list of Spring's active profiles.