public static void validatePassword(String password, String username, Errors err) {
		if(password == null || password.isEmpty()) {
    		err.rejectValue("password", "password.empty");
    	} else {
			if (password.length() < PASSWORD_MIN_LENGTH) {
				err.rejectValue("password", "password.length", new Integer[]{ PASSWORD_MIN_LENGTH }, null);
			}
			if (!password.matches(".*[a-z].*") || !password.matches(".*[A-Z].*")) {
				err.rejectValue("password", "password.upperlower");
			}
			if (!password.matches(".*[0-9].*")) {
				err.rejectValue("password", "password.digit");
			}
			if(username != null && password.contains(username)) {
				err.rejectValue("password", "password.containsusername");
			}
    	}
	}