In a spring boot application, i get this error
Error creating bean with name 'webSecurityConfigurerAdapter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private server.service.UserServiceImpl server.ServerApplicationSecurity.userDetailsService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [server.service.UserServiceImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
public class ServerApplicationSecurity extends WebSecurityConfigurerAdapter {
@Autowired
private UserServiceImpl userDetailsService;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService);
}
...
}
@Service
public class UserServiceImpl implements UserDetailsService, UserService {
private final UserAppRepository repository;
@Autowired
public UserServiceImpl(final UserAppRepository repository) {
this.repository = repository;
}
...
}
My class use @Service and the bean have Autowired, so i don't understand why i get this error.