Spring3.x Security 简单应用
?登录成功处理:
LoginSuccessHandler?
?登录失败处理:
loginFailureHandler
import java.util.List;/** * 查找指定用户 * @author Theodore * */public class CustomerDetailsBiz extends BaseBiz<Customer, CustomerDao>implements UserDetailsService {private static final Log log = LogFactory.getLog(CustomerDetailsBiz.class);@Resourceprivate CustomerBiz xxxBiz;/** * * <p> * 根据后台用户名查找用户并加载用户的详细信息 * </p> * * @param * @return UserDetails * @throws */@Overridepublic UserDetails loadUserByUsername(String userId)throws UsernameNotFoundException {Customer customer = xxxBiz.getCustomer(userId);if (customer != null) {//如果该用户可以登录} else { //如果没有找到该用户,需要创建一个空对象customer = new Customer();}return customer;}}?