main方法

public static void main(String[] args) {

BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
//加密所需的salt(盐)
textEncryptor.setPassword("Yc@0!9IsC");
//要加密的数据(数据库的用户名或密码)
String s1 = textEncryptor.encrypt("ftp21");
String s2 = textEncryptor.encrypt("Summer2018");
String s3 = textEncryptor.encrypt("Anfang@123!");
// String s4 = textEncryptor.encrypt("admin123");
String s5 = textEncryptor.encrypt("cegs");
String s6 = textEncryptor.encrypt("ivms_thr");
String s7 = textEncryptor.encrypt("Anfang@123!");
String s8 = textEncryptor.encrypt("123456");
String s9 = textEncryptor.encrypt("ftp21");

System.out.println("s1: "+s1);
System.out.println("s2: "+s2);
System.out.println("s3: "+s3);
// System.out.println("ftp.privateUser: "+s4);
System.out.println("ftp.privatePwd: "+s5);
System.out.println("ftp.intranetUser: "+s6);
System.out.println("Anfang@123!:" + s7);
System.out.println("123456:" + s8);
System.out.println("ftp21:" + s9);

}

依赖

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

启动类 + 注解

@SpringBootApplication
@EnableEncryptableProperties  //加密注解
//@PropertySource(name="EncryptedProperties", value = "classpath:/application.properties")
public class Application
{
public static void main( String[] args )
{
/*BCryptPasswordEncoder en = new BCryptPasswordEncoder();
String pw = en.encode("12345611111");*/
SpringApplication sa = new SpringApplication(Application.class);
sa.setBannerMode(Banner.Mode.OFF);
sa.run(args);
}
}

java application.properties 密码加密的更多相关文章

  1. 如果你的application.properties中还存在明文密码----加密Spring Boot中的application.properties

    1 概述 什么?都2020年了还在Spring Boot的配置文件中写明文密码? 虽然是小项目,明文也没人看. 明文简单快捷方便啊!!! 你看直接用户名root密码123456多么简单!!! ... ...

  2. application.properties多环境配置文件、jar包外部配置文件、配置项加密、程序中配置使用

    一.简介 spring boot项目application.properties文件存放及使用介绍 二.方法一多环境配置文件 我们一般都会有多个应用环境,开发环境.测试环境.生产环境,各个环境的配置会 ...

  3. 使用哈希加盐法来为密码加密(补充JAVA的实现)

    使用哈希加盐法来为密码加密 转自:http://www.cnblogs.com/jfzhu/p/4023439.html 转载请注明出处   (一)为什么要用哈希函数来加密密码 如果你需要保存密码(比 ...

  4. java工具类学习,系统中用户密码加密总结

    现在项目,用户注册登录部分很少有涉及到了,原因:现在热门开发框架都已经在底层帮我们做了一套用户注册,密码加密,登录认证,权限控制,缓存数据等基本功能. 这有利于项目的快速完成,只需要搬砖码畜们专注于业 ...

  5. Java 读取application.properties配置文件中配置

    实际开发中若需要读取配置文件application.properties中的配置,代码如下.例:读取配置文件中name属性配置值: 代码如下: import org.springframework.c ...

  6. 基于RSA的前后端登陆密码加密JAVA实现(转)

    RSA加密算法简介 SA加密算法是一种非对称加密算法.在公开密钥加密和电子商业中RSA被广泛使用.对极大整数做因数分解的难度决定了RSA算法的可靠性.换言之,对一极大整数做因数分解愈困难,RSA算法愈 ...

  7. Java 第十一届 蓝桥杯 省模拟赛 凯撒密码加密

    凯撒密码加密 题目 问题描述 给定一个单词,请使用凯撒密码将这个单词加密. 凯撒密码是一种替换加密的技术,单词中的所有字母都在字母表上向后偏移3位后被替换成密文.即a变为d,b变为e,-,w变为z,x ...

  8. Spring Boot (四): Druid 连接池密码加密与监控

    在上一篇文章<Spring Boot (三): ORM 框架 JPA 与连接池 Hikari> 我们介绍了 JPA 与连接池 Hikari 的整合使用,在国内使用比较多的连接池还有一个是阿 ...

  9. Spring Boot 配置文件密码加密两种方案

    Spring Boot 配置文件密码加密两种方案 jasypt 加解密 jasypt 是一个简单易用的加解密Java库,可以快速集成到 Spring 项目中.可以快速集成到 Spring Boot 项 ...

随机推荐

  1. hdu 6096 String

    题 OvO http://acm.hdu.edu.cn/showproblem.php?pid=6096 ( 2017 Multi-University Training Contest - Team ...

  2. 基于python的爬虫项目

    一.项目简介 1.1 项目博客地址 https://www.cnblogs.com/xsfa/p/12083913.html 1.2 项目完成的功能与特色 爬虫和拥有三个可视化数据分析 1.3 项目采 ...

  3. gdb插件gef安装爬坑

    0x00: gdb是linux下的调试利器,但无奈界面不太友好,所以需要一些辅助插件. 0x01:关于插件选择 之前我一直使用的是pead,之前了解到还有个插件gef,因为gef支持多构架,而且hea ...

  4. Ubuntu下的redis安装过程

    Redis make test Errors? - Stack Overflow  https://stackoverflow.com/questions/48425998/redis-make-te ...

  5. js输入密文弹出数字键盘

    我们经常被产品要求,在移动端的web页面上的输入框输入密码时要弹出数字键盘,而不是全键盘,这个该怎么实现呢? 1.首先要弹出数字键盘,我们只能把input框的type从password改为tel 2. ...

  6. Python实现telnet命令测试防火墙

    Python实现telnet命令测试防火墙 telnet主要用于测试主机端口是否开通 ping主要是用来测试网络是否畅通和主机是否正在使用 使用Python实现Telnet测试主机端口是否开通的功能. ...

  7. 微信小程序_(组件)swiper轮播图

    微信小程序swiper轮播图组件官方文档 传送门 Learn: swiper组件 一.swiper组件 indicator-dots:是否显示面板指示点[默认值false] autoplay:是否自动 ...

  8. nagios监控部署

    nagios监控部署. 在部署之前把依赖包安装了. [root@tiandong63 ~]# yum install -y gcc glibc glibc-common php gd gd-devel ...

  9. ASIHTTPRequest使用

    http://qk13warcraft.blog.163.com/blog/static/157549344201271633014969/ 1.创建和运行请求 创建一个同步请求 这是最简单的用法,发 ...

  10. mybatis延迟加载(assocation)

    一.何为延迟加载? 延迟加载 我们并不需要总是在加载用户信息时就一定要加载他的账户信息.此时就是我们所说的延迟加载. 就是在需要用到数据时才进行加载,不需要用到数据时就不加载数据.延迟加载也称懒加载. ...