BaseEncryptTest.java 663 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
package com.example.demo;

import org.jasypt.encryption.StringEncryptor;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

@SpringBootTest
class BaseEncryptTest {
    @Resource(name = "lazyJasyptStringEncryptor")
    private StringEncryptor encryptor;

    @Value("${plain}")
    private String plain;

    @Value("${cipher}")
    private String cipher;

    @Test
    void encrypt() {
        System.out.println(encryptor.encrypt(plain));
    }

    @Test
    void decrypt() {
        System.out.println(cipher);
    }

}