After generating a simple web app using Spring initializr, I created 2 YML files in src/main/resources
folder:
application.yml
application-prod.yml
and added 2 different values inside each of them:
# application-prod.yml
app:
name: demo-prod
#application.yml
app:
name: demo-local
Then I built the app with mvn clean install -Dspring.profiles.active=prod -DskipTests
.
And started the app with mvn spring-boot:run -Dspring.profiles.active=prod
.
Looking at the log lines of the startup, I can see that there was no active profile defined and Spring will fall back to the default one:
No active profile set, falling back to default profiles: default`
What am I missing, why Spring didn't see my profile prod
passed in from the CLI?