Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Springboot, use application-{profile}.properties

I have created 2 files under src/main/resources:

  • application.properties
  • application-local.properties

The first one has properties that take values from env variables, while the latter has fixed values.

According to specific here, I've launched spring boot in such way:

mvn spring-boot:run -Dspring.profiles.active=local

However no effects are produced and application-local.properties seems to be ignored.

Any hints?

like image 971
Fabrizio Stellato Avatar asked Nov 01 '25 11:11

Fabrizio Stellato


1 Answers

Yeah, if you're running with the spring-boot plugin, you have to pass the profile with -Dspring-boot.run.profiles, try

mvn spring-boot:run -Dspring-boot.run.profiles=local
like image 133
lane.maxwell Avatar answered Nov 04 '25 02:11

lane.maxwell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!