docs(global): Optimised javadoc, changed the spelling to British English.
This commit is contained in:
+19
-10
@@ -29,17 +29,27 @@ import java.util.HashMap;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* PropertyEncryptor is a utility class designed for encrypting configuration
|
||||
* information in Spring Boot applications.
|
||||
* {@code PropertyGuard} is a utility class designed for encrypting
|
||||
* configuration properties in Spring Boot applications.
|
||||
* <p>
|
||||
* Spring Boot applications often need to store sensitive configuration details
|
||||
* such as database passwords, API keys, etc. To ensure that these sensitive
|
||||
* pieces of information are not exposed, developers can utilize the
|
||||
* {@code PropertyGuard} class to encrypt and store them within configuration
|
||||
* files.
|
||||
* pieces of information are not exposed to the public, developers can utilize
|
||||
* the {@code PropertyGuard} class to encrypt and store them within
|
||||
* configuration files.
|
||||
* <p>
|
||||
* <b>Usage</b>
|
||||
* In {@code application.yml} or {@code application.properties}:
|
||||
* You need a 16-char long secret for encrypting a configuration property. You
|
||||
* can get this secret on your own, or use the helper utility class by the
|
||||
* following code:
|
||||
* <pre>{@code
|
||||
* var secret = AesUtil.generateRandomSecret(); // Let's presume the result is
|
||||
* // "3856faef0d2d4f33"
|
||||
* }</pre>
|
||||
* <p>
|
||||
* Then, in {@code application.yml} or {@code application.properties}, change
|
||||
* the original value from plain text to encrypted value with the prefix
|
||||
* "<code>pg:</code>".
|
||||
* <pre>
|
||||
* # original
|
||||
* app.example-properties=Sample Value
|
||||
@@ -47,16 +57,15 @@ import java.util.Optional;
|
||||
* # encrypted with key 3856faef0d2d4f33
|
||||
* app.example-properties=pg:t4YBfv8M9ZmTzWgTi2gJqg==
|
||||
* </pre>
|
||||
* Then, add the command line arguments like {@code --pe.key=3856faef0d2d4f33}.
|
||||
* After that, before running, you need to add the command line arguments
|
||||
* "pg.key" as the following codes: {@code --pg.key=<the secret>}.
|
||||
* <p>
|
||||
* This class is extracted from <a href="https://baomidou.com/pages/e0a5ce/"
|
||||
* >MyBatis-Plus</a>.
|
||||
* <p>
|
||||
* The prefix to specify the encrypted value is {@code pg}.
|
||||
*
|
||||
* @author hubin@baomidou
|
||||
* @version 1.1.0
|
||||
* @see org.springframework.boot.env.EnvironmentPostProcessor
|
||||
* @see EnvironmentPostProcessor
|
||||
* @since 1.1.0 (3.3.2 of MyBatis-Plus)
|
||||
*/
|
||||
public class PropertyGuard implements EnvironmentPostProcessor {
|
||||
|
||||
Reference in New Issue
Block a user