why i always get userDetailDao exception null when executed :
package com.springweb.service;
import com.springweb.dao.UserDetailDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.dao.DataAccessException;
import org.springframework.security.userdetails.UserDetails;
import org.springframework.security.userdetails.UserDetailsService;
import org.springframework.security.userdetails.UsernameNotFoundException;
public class UserService implements UserDetailsService
{
@Autowired
UserDetailDao userDetailDao;
public UserDetails loadUserByUsername(String string) throws UsernameNotFoundException, DataAccessException {
return userDetailDao.queryForUser(string);
}
}
at my spring security config :
<security:authentication-provider user-service-ref="userService">
<security:password-encoder hash="md5" />
</security:authentication-provider>
<bean name="userService" class="com.springweb.service.UserService">
</bean>
and at my dispatcher context, i already define to scan package:
<context:component-scan base-package="com.springweb"/>