Skip to content

Commit f5bcdac

Browse files
committed
refactor: mark PropertyGuard as deprecated and for removal
1 parent 18682e8 commit f5bcdac

File tree

1 file changed

+7
-1
lines changed
  • property-guard-spring-boot-starter/src/main/java/com/onixbyte/propertyguard/autoconfiguration

1 file changed

+7
-1
lines changed

property-guard-spring-boot-starter/src/main/java/com/onixbyte/propertyguard/autoconfiguration/PropertyGuard.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.springframework.core.env.MapPropertySource;
2828
import org.springframework.core.env.SimpleCommandLinePropertySource;
2929

30+
import java.security.GeneralSecurityException;
3031
import java.util.HashMap;
3132
import java.util.Optional;
3233

@@ -65,6 +66,7 @@
6566
* @see EnvironmentPostProcessor
6667
* @since 1.1.0 (3.3.2 of MyBatis-Plus)
6768
*/
69+
@Deprecated(forRemoval = true)
6870
public class PropertyGuard implements EnvironmentPostProcessor {
6971

7072
private final static Logger log = LoggerFactory.getLogger(PropertyGuard.class);
@@ -99,7 +101,11 @@ public void postProcessEnvironment(ConfigurableEnvironment environment, SpringAp
99101
for (var name : source.getPropertyNames()) {
100102
if (source.getProperty(name) instanceof String str) {
101103
if (str.startsWith("%s:".formatted(PREFIX))) {
102-
map.put(name, AesUtil.decrypt(str.substring(3), encryptionKey));
104+
try {
105+
map.put(name, AesUtil.decrypt(str.substring(3), encryptionKey));
106+
} catch (GeneralSecurityException e) {
107+
log.error("Unable to decrypt param {}", name);
108+
}
103109
}
104110
}
105111
}

0 commit comments

Comments
 (0)