We have 2 micro services:
config-service and my-actual-service
We have a separate Git project that has all the springboot/springcloud configurations.
my-actual-service reaches out to config-service and config-service fetches the appropriate config from Github.
The config is loaded fine, but then it throws parsing error on the datasource section:
org.springframework.cloud.config.server.environment.FailedToConstructEnvironmentException:
Could not construct context for config=myconfig profile=dev label= includeOrigin=true; nested exception is while parsing a block mapping
in 'reader', line 3, column 5:
url: jdbc:oracle:thin:@myserver ...
^
expected <block end>, but found '<scalar>'
in 'reader', line 5, column 23:
password: {cipher}encrypted_password ...
^
at org.springframework.cloud.config.server.environment.NativeEnvironmentRepository.findOne(NativeEnvironmentRepository.java:165) ~[spring-cloud-config-server-4.0.1.jar:4.0.1]
at org.springframework.cloud.config.server.environment.AbstractScmEnvironmentRepository.findOne(AbstractScmEnvironmentRepository.java:64) ~[spring-cloud-config-server-4.0.1.jar:4.0.1]
at org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.findOneFromCandidate(MultipleJGitEnvironmentRepository.java:195) ~[spring-cloud-config-server-4.0.1.jar:4.0.1]
at org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.findOne(MultipleJGitEnvironmentRepository.java:178) ~[spring-cloud-config-server-4.0.1.jar:4.0.1]
at org.springframework.cloud.config.server.environment.ObservationEnvironmentRepositoryWrapper.lambda$findOne$3(ObservationEnvironmentRepositoryWrapper.java:75) ~[spring-cloud-config-server-4.0.1.jar:4.0.1]
This is the config:
spring:
datasource:
url: "jdbc:oracle:thin:@myserver:port:sid"
username: USER
password: {cipher}encrypted_password
Can't figure out what might be going on here. I tried the url with quotes, with double quotes and without any quotes with no change.
We are using Spring boot / cloud version: 3.0.2.
It was a simple thing, the whole password string, as it had curly braces, needed to be in single quotes, so like:
'{cipher}encrypted_password'.What threw me off was that it started complaining on the
urlline. Theurlline doesn't need to have single or double quotes.