在我們的服務中不可避免的需要使用到一些秘鑰(資料庫、redis等)
開發和測試環境還好,但生產如果採用明文配置講會有安全問題,jasypt是乙個通用的加解密庫,我們可以使用它。
<dependency
>
<
groupid
>com.github.ulisesbocchio
groupid
>
<
artifactid
>jasypt-spring-boot-starter
artifactid
>
<
version
>2.1.1
version
>
dependency
>
配置檔案:
# 加密的金鑰# 測試環境可以採用在配置檔案中配置
# 生產環境建議採用啟動引數的形式傳入
# 其他配置引數參考:com.ulisesbocchio.jasyptspringboot.properties.jasyptencryptorconfigurationproperties
jasypt.encryptor.password=you salt
# 解密得到原始密碼
spring.datasource.password= enc(密文)
那密文怎麼來的呢?
@autowiredstringencryptor stringencryptor;
@test
public
void
encrypt()
publicstatic
void
main(string args)
Jquery 獲取Form表單並返回Jason物件
var formdata widget search form serializearray var jsoncondition 拼接需要傳輸的引數 var formdata widget search form serializearray each formdata,function index...
SpringBoot使用thymeleaf模板
springboot開發的web專案contrller如何跳轉到前端頁面 據說,最流行的還是freemarker和velocity這兩種模板,我們這裡用spring官方推薦的thymeleaf模板 在建立好springboot專案的基礎上,進行如下配置 在pom中到thymeleaf的依賴 org....
Spring Boot使用Undertow做伺服器
1 建立spring boot專案,修改其pom.xml檔案 org.springframework.boot spring boot starter test org.springframework.boot spring boot starter web org.springframework....