0

How to bind datasource property from env variables Spring boot

I have some property

spring.datasource.url=
spring.datasource.username=
spring.datasource.password=

and i need to fill db connection parameters from env variable

java -jar demo-0.0.1-SNAPSHOT.jar -DdbUrl=URL -DdbUser=USER -DdbPassword=PASSWORD

how can i do this? binding like spring.datasource.url=${URL} doesnt works(

stoxa
  • 3
  • 2

1 Answers1

0

Try to pass your parameters like:

--spring.datasource.url=jdbc:xx:xx:xxx

Instead of -DparamName

stinger
  • 3,790
  • 1
  • 19
  • 30
  • it works! but now nowi need skip tests during datasource autoconfiguration when I building applicatipn – stoxa May 31 '18 at 10:21