[英]Spring yaml property java.util.LinkedHashMap cannot be cast to java.lang.String
I try to pass Docker env variable in my Spring boot application.yml like this:我尝试在我的 Spring boot application.yml 中传递 Docker 环境变量,如下所示:
security:
saml2:
relyingparty:
registration:
my-saml:
signing:
credentials:
- private-key-location: classpath:HARD_PATH_TO_KEY
certificate-location: classpath:HARD_PATH_TO_CERT
identityprovider:
verification.credentials:
- certificate-location: classpath:HARD_PATH_TO_CERT
entity-id: MY_ID
singlesignon:
url: {{saml.ip.singlesignon.url}}
sign-request: true
But when I use env variable to但是当我使用环境变量来
- private-key-location: {{saml.ip.private.key}}
certificate-location: {{saml.ip.certif.emp}}
and和
verification.credentials:
- certificate-location: {{saml.ip.certif2.emp}}
I got this error:我收到此错误:
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.lang.String
at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at org.springframework.beans.factory.config.YamlProcessor.buildFlattenedMap(YamlProcessor.java:309)
at org.springframework.beans.factory.config.YamlProcessor.lambda$buildFlattenedMap$1(YamlProcessor.java:325)
at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at org.springframework.beans.factory.config.YamlProcessor.buildFlattenedMap(YamlProcessor.java:309)
at org.springframework.beans.factory.config.YamlProcessor.lambda$buildFlattenedMap$1(YamlProcessor.java:325)
at java.util.Collections$SingletonMap.forEach(Collections.java:4910)
Any idea任何的想法
Try to remove the '-' at the beginning of lines尝试删除行首的“-”
private-key-location: {{saml.ip.private.key}}
certificate-location: {{saml.ip.certif.emp}}
...
certificate-location: {{saml.ip.certif2.emp}}
If you want 2 separate Strings, or credentials
is a Map, I think it should be:如果你想要 2 个单独的字符串,或者credentials
是一个 Map,我认为它应该是:
credentials:
private-key-location: {{saml.ip.private.key}}
certificate-location: {{saml.ip.certif.emp}}
If you want an array, I think it should be:如果你想要一个数组,我认为它应该是:
credentials:
- private-key-location: {{saml.ip.private.key}}
- certificate-location: {{saml.ip.certif.emp}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.