lizijie
2019-06-22 15c4ec98dace455967335a27d0f0efdcdfc61f29
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
package com.moral;
 
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.test.context.junit4.SpringRunner;
 
import javax.annotation.Resource;
 
@RunWith(SpringRunner.class)
@SpringBootTest
public class ScreenApiApplicationTests {
 
    @Test
    public void contextLoads() {
    }
    @Resource
    private BCryptPasswordEncoder encoder;
    @Test
    public void testEncoder(){
        String hash = encoder.encode("123456");
        System.out.printf("\n============================\n");
        System.out.printf("hash:"+hash);
//        Boolean result = encoder.matches("123456",hash);
 
//        System.out.printf("result:"+result);
        System.out.printf("\n============================\n");
    }
}