Hi, I'm new here...
I'm trying to use @EJB in Class UserDetailsServiceImpl - using Spring Security 3.1.3
for example:
Error logCode:@Service(value="userDetailsServiceImpl") public class UserDetailsServiceImpl implements UserDetailsService , UsersService{ @EJB private UsersDAO usersDAO; @Transactional(readOnly=true) @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return getFindByUserName(username); } @Override public Users getFindByUserName(String username) { return usersDAO.getFindByUserName(username); }
Code:INFO: ERROR: org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [br.com.dentalclinic.dao.users.UsersDAO] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.ejb.EJB(beanName=, mappedName=, beanInterface=class java.lang.Object, description=, name=, lookup=)} at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:301) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1073) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [br.com.dentalclinic.dao.users.UsersDAO] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.ejb.EJB(beanName=, mappedName=, beanInterface=class java.lang.Object, description=, name=, lookup=)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793)
Help me!!


Reply With Quote