瀏覽代碼

改进安全加密处理器密钥获取.

https://github.com/baomidou/mybatis-plus/issues/6625
nieqiurong 5 月之前
父節點
當前提交
841b24e9ce

+ 1 - 12
spring-boot-starter/mybatis-plus-spring-boot-autoconfigure/src/main/java/com/baomidou/mybatisplus/autoconfigure/SafetyEncryptProcessor.java

@@ -24,7 +24,6 @@ import org.springframework.boot.env.OriginTrackedMapPropertySource;
 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;
 
@@ -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");
         /**
          * 处理加密内容
          */