This is what I'm having problems with in my application.yml file:
url: ${DATASOURCE_URL:jdbc:postgresql://localhost:5432/postgres}
It seems to treat it like it should cut it at the last colon:
Message: Invalid JDBC URL [5432/postgres]. JDBC URLs must start with 'jdbc'.
Tried escaping with ', " and \ in different sections, nothing seems to work. Tried even combining them
url: "${DATASOURCE_URL:jdbc\\:postgresql\\://localhost\\:5432/postgres}"
and
url: "${DATASOURCE_URL:jdbc\:postgresql\://localhost\:5432/postgres}"
Edit: this value needs to be empty if not defined due to Micronaut Test Resources I'm using. It will create test resources only if value is empty or not defined.
Edit: realized I'm using micronaut instead of spring boot. No wonder the suggestions didn't work.
Edit: I can't omit the url configuration, as I have two different datasources. Omitting would only work for the default one AFAIK - I have to configure the additional datasource somehow, which is what I'm trying to achieve here.
For Micronaut, your url configuration with a placeholder "DATASOURCE_URL" and a default value should look like:
url: ${DATASOURCE_URL:`jdbc:postgresql://localhost:5432/postgres`}
Uses backticks "`" to escape the JDBC URL because of the colon ":".
If you are using Micronaut Test Resources, you can omit the URL configuration all together.
datasources:
default:
driver-class-name: org.postgresql.Driver # Used by Micronaut Data
dialect: POSTGRES
#schema-generate: CREATE_DROP
db-type: postgres # Used by Micronaut Test Resources