Provides a way to disable DecryptEnvironmentPostProcessor.

Fixes gh-927
This commit is contained in:
spencergibb
2021-03-15 21:33:41 -04:00
parent 4995ffc88a
commit cde355e5e5
3 changed files with 21 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ public class DecryptEnvironmentPostProcessor extends AbstractEnvironmentDecrypt
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
if (bootstrapEnabled(environment) || useLegacyProcessing(environment)) {
if (bootstrapEnabled(environment) || useLegacyProcessing(environment) || !isEnabled(environment)) {
return;
}
if (!ClassUtils.isPresent("org.springframework.security.crypto.encrypt.TextEncryptor", null)) {
@@ -71,4 +71,8 @@ public class DecryptEnvironmentPostProcessor extends AbstractEnvironmentDecrypt
}
protected Boolean isEnabled(ConfigurableEnvironment environment) {
return environment.getProperty("spring.cloud.decrypt-environment-post-processor.enabled", Boolean.class, true);
}
}

View File

@@ -47,6 +47,12 @@
"type": "java.lang.String",
"description": "Comma separated list of class names for beans to never be refreshed or rebound.",
"defaultValue": true
},
{
"name": "spring.cloud.decrypt-environment-post-processor.enabled",
"type": "java.lang.Boolean",
"description": "Enable the DecryptEnvironmentPostProcessor.",
"defaultValue": true
}
]
}