我在AKS中使用这些属性创建了一个configmap
config-application-dev.properties: |
server.port=5001
server.compression.enabled=true
azure.keyvault.uri=<URL>
azure.keyvault.client-id=<CLIENTID>
azure.keyvault.client-key=<CLIENTKEY>
我的Spring启动应用程序使用@PropertySource读取这些属性
@PropertySource({ "${propertiesDir}/${envTarget}/config/config-application-${envTarget}.properties" })
public class Application{
...
}
我想使用@Value属性读取密钥
@Value("${azure-key-vault-secret}")
private String mySecretProperty;
但是,当SpringBoot启动时,它会抛出此错误消息... 它无法解析占位符... 与天青的连接不起作用?
2019-08-21 16:17:26.051 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'exampleController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'secret-in-keyvault' in value "${secret-in-keyvault}"