Skip to content

Commit

Permalink
改进安全加密处理器密钥获取.
Browse files Browse the repository at this point in the history
  • Loading branch information
nieqiurong committed Jan 11, 2025
1 parent f18028c commit 841b24e
Showing 1 changed file with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.core.env.SimpleCommandLinePropertySource;

import java.util.HashMap;

Expand All @@ -38,17 +37,7 @@ public class SafetyEncryptProcessor implements EnvironmentPostProcessor {

@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
/**
* 命令行中获取密钥
*/
String mpwKey = null;
for (PropertySource<?> ps : environment.getPropertySources()) {
if (ps instanceof SimpleCommandLinePropertySource) {
SimpleCommandLinePropertySource source = (SimpleCommandLinePropertySource) ps;
mpwKey = source.getProperty("mpw.key");
break;
}
}
String mpwKey = environment.getProperty("mpw.key");
/**
* 处理加密内容
*/
Expand Down

0 comments on commit 841b24e

Please sign in to comment.