Store MongoDB Credentials as Environment Variables fails

Hi, I don’t want to have user and pass of db hard coded in srv URI link in my Java springboot app. So I put user and pass in my env variables(IDE Intellij):

DB_USERNAME = userDb
DB_PASSWORD = 1234

and have this URI in my application.properties file:

spring.data.mongodb.username = {DB_USERNAME} spring.data.mongodb.password = {DB_PASSWORD}
spring.data.mongodb.uri=mongodb+srv://{DB_USERNAME}:{DB_PASSWORD}@kingcodedb.asdk.mongodb.net/sample_mflix

but my test with this URI failsm while it works perfectly fine with the user and pass hard coded in URI.

Any help and idea how to resolve this issue?