| | |
| | | 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 |
| | |
| | | @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"); |
| | | } |
| | | } |