springboot集成jasypt

Jasypt這個Java類包爲開發人員提供一種簡單的方式來爲項目增加加密功能,包括:密碼Digest認證,文本和對象加密,集成hibernate,Spring Security(Acegi)來增強密碼管理。Jasypt開發團隊推出了Java加密工具Jasypt 1.4,它可與Spring Framework、Hibernate和Acegi Security集成;

詳情見URL

springboot 集成jasypt

首先是版本選擇 建議:

springboot版本 jasypt版本
2.1.0 2.1.0
1.4.2 1.5
1.5.3 1.5

本文主要介紹 springboot1.4.2版本的集成數據庫密碼加密 

首先 pom 文件引入

 <dependency>
            <groupId>com.github.ulisesbocchio</groupId>
            <artifactId>jasypt-spring-boot-starter</artifactId>
            <version>1.5</version>
        </dependency>

cmd窗口 執行命名行

 

  java -cp C:\.m2\repository\org\jasypt\jasypt\1.9.2\jasypt-1.9.2.jar  org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="數據庫密碼" password=鹽值 algorithm=PBEWithMD5AndDES

以及對應的

 

注意:  儘量選用版本高的mybaits  以及 tk.mybatis 插件引用,

這樣才能避免更多坑 

  <dependency>
            <groupId>tk.mybatis</groupId>
            <artifactId>mapper-spring-boot-starter</artifactId>
            <version>2.1.5</version>
        </dependency>

本文引用的2.1.5 

之前引用低版本的會報錯 如下 

Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property ‘mapperHelper’ of bean class [org.mybatis.spring.mapper.MapperFactoryBean]: Bean property ‘mapperHelper’ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?


 升級了版本就解決了

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章