Skip to content

Instantly share code, notes, and snippets.

@shinyay
Created June 14, 2021 14:15
Show Gist options
  • Select an option

  • Save shinyay/7e49da8658eb46f1042eb9f04528fffa to your computer and use it in GitHub Desktop.

Select an option

Save shinyay/7e49da8658eb46f1042eb9f04528fffa to your computer and use it in GitHub Desktop.
Run Spring Boot app with Profile

Run Spring Boot app with Profile

Profile

app.name=sample
app.name.profile=default
#---
spring.config.activate.on-profile=dev
app.name.profile=dev
#---
spring.config.activate.on-profile=prod
app.name.profile=prod

Run app

Gradle BootRun

$ ./gradlew clean bootRun --args='--spring.profiles.active=dev'

Run JAR

$ java -jar -Dspring.profiles.active=dev app.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment