diff --git a/src/main/java/com/monkeyk/sos/infrastructure/PasswordHandler.java b/src/main/java/com/monkeyk/sos/infrastructure/PasswordHandler.java index 85f36ab..4224052 100644 --- a/src/main/java/com/monkeyk/sos/infrastructure/PasswordHandler.java +++ b/src/main/java/com/monkeyk/sos/infrastructure/PasswordHandler.java @@ -1,6 +1,7 @@ package com.monkeyk.sos.infrastructure; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import com.monkeyk.sos.web.context.SOSContextHolder; +import org.springframework.security.crypto.password.PasswordEncoder; /** * 2016/3/25 @@ -10,12 +11,16 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; public abstract class PasswordHandler { +// private PasswordEncoder passwordEncoder = SOSContextHolder.getBean(PasswordEncoder.class); + + private PasswordHandler() { } public static String encode(String password) { - BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); - return encoder.encode(password); + PasswordEncoder passwordEncoder = SOSContextHolder.getBean(PasswordEncoder.class); +// BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); + return passwordEncoder.encode(password); } }