1

I'm trying to use environment variable in a application.properties in the Spring Boot, but the static value has some ':' in the middle.

spring.data.mongodb.uri = {$URI:mongodb://user:pass@host.mlab.com:port/db}

But this don't work, i guess it's because

mongodb://user:pass@host.mlab.com:port/db

has ':' in it. I want to use environment variable when available, but if don't use the static configuration, like this works pretty well:

server.port=${PORT:8080}

Do anyone knows how to solve this problem?

Ryuzaki L
  • 37,302
  • 12
  • 68
  • 98
Sham Fiorin
  • 403
  • 4
  • 16

1 Answers1

1

Represent the string double quotes

{$URI: "mongodb://user:pass@host.mlab.com:port/db"}
Ryuzaki L
  • 37,302
  • 12
  • 68
  • 98