FailedToConstructEnvironmentException when get config file
Describe the bug I created one configuration 'spring.config.import: optional:configserver:' in github repo in application.yaml And configure this repo to config server 'spring.cloud.config.server.git.uri: https://github.com/leonard520/spring-petclinic-microservices-config.git' FailedToConstructEnvironmentException seen whenever get any config file, eg. curl http://localhost:8888/customers-service-default.json will lead to the below 500 internal error. Error getting the Environment with name=customers-service profiles=default label=null includeOrigin=false
org.springframework.cloud.config.server.environment.FailedToConstructEnvironmentException: Could not construct context for config=customers-service profile=default label= includeOrigin=false; nested exception is mapping values are not allowed here in 'reader', line 32, column 44: ... ig.import: optional:configserver: ^
at org.springframework.cloud.config.server.environment.NativeEnvironmentRepository.findOne(NativeEnvironmentRepository.java:159) ~[classes/:na]
at org.springframework.cloud.config.server.environment.AbstractScmEnvironmentRepository.findOne(AbstractScmEnvironmentRepository.java:57) ~[classes/:na]
at org.springframework.cloud.config.server.environment.MultipleJGitEnvironmentRepository.findOne(MultipleJGitEnvironmentRepository.java:173) ~[classes/:na]
at org.springframework.cloud.config.server.environment.CompositeEnvironmentRepository.findOne(CompositeEnvironmentRepository.java:64) ~[classes/:na]
at org.springframework.cloud.config.server.environment.EnvironmentEncryptorEnvironmentRepository.findOne(EnvironmentEncryptorEnvironmentRepository.java:61) ~[classes/:na]
at org.springframework.cloud.config.server.environment.EnvironmentController.getEnvironment(EnvironmentController.java:132) ~[classes/:na]
at org.springframework.cloud.config.server.environment.EnvironmentController.labelled(EnvironmentController.java:119) ~[classes/:na]
at org.springframework.cloud.config.server.environment.EnvironmentController.labelledJsonProperties(EnvironmentController.java:183) ~[classes/:na]
at org.springframework.cloud.config.server.environment.EnvironmentController.jsonProperties(EnvironmentController.java:175) ~[classes/:na]
Sample If possible, please provide a test case or sample application that reproduces the problem. This makes it much easier for us to diagnose the problem and to verify that we have fixed it.
Suspect this is because the config content 'optional:configserver:' is treated as yaml as well and try to parse it.
Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.