У меня есть что-то вроде этого:
Код: Выделить всё
@Getter
@Setter
@ConfigurationProperties("ssl")
public class SSLProperties {
@Value("${MySecret}")
private String trustStorePass;
private TrustStore trustStore;
@Data
public static class TrustStore {
private String path;
}
}
Код: Выделить всё
@Configuration
@EnableConfigurationProperties({ SSLProperties.class })
public class MyConfigs{
Код: Выделить всё
SPRING_CLOUD_AZURE_KEYVAULT_SECRET_PROPERTY_SOURCES_0_ENDPOINT=
SPRING_CLOUD_AZURE_KEYVAULT_SECRET_PROPERTY_SOURCES_0_PROFILE_TENANT_ID=
SPRING_CLOUD_AZURE_KEYVAULT_SECRET_PROPERTY_SOURCES_0_CREDENTIAL_CLIENT_SECRET=
SPRING_CLOUD_AZURE_KEYVAULT_SECRET_PROPERTY_SOURCES_0_CREDENTIAL_CLIENT_ID=
Код: Выделить всё
SPRING_CLOUD_AZURE_KEYVAULT_SECRET_PROPERTY_SOURCES_0_PROFILE_TENANT_ID=
SPRING_CLOUD_AZURE_KEYVAULT_SECRET_PROPERTY_SOURCES_0_CREDENTIAL_CLIENT_SECRET=
SPRING_CLOUD_AZURE_KEYVAULT_SECRET_PROPERTY_SOURCES_0_CREDENTIAL_CLIENT_ID=
Код: Выделить всё
spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=
Код: Выделить всё
Caused by: org.springframework.util.PlaceholderResolutionException: Could not resolve placeholder 'MySecret' in value "${MySecret}"
at org.springframework.util.PlaceholderResolutionException.withValue(PlaceholderResolutionException.java:81)
at org.springframework.util.PlaceholderParser$ParsedValue.resolve(PlaceholderParser.java:423)
at org.springframework.util.PlaceholderParser.replacePlaceholders(PlaceholderParser.java:128)
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:118)
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:114)
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:255)
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:226)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:201)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:971)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1649)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1627)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:785)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:768)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:146)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:509)
... 33 common frames omitted
The code is modified a bit as it is work related and I cannot just copy-paste it, but only names are changed
Я хочу сделать это таким образом, но не могу заставить это работать.
В чем причина?>
Подробнее здесь: https://stackoverflow.com/questions/798 ... pring-boot
Мобильная версия