I am trying to programatically validate a user login/pass using Spring Security, so I need to have access to the ProviderManager. I would like it to be automatically injected into my @Controller.
My code looks like:
import org.springframework.security.authentication.ProviderManager;
...
@Controller
public class MyController {
@Autowired
private ProviderManager authenticationManager;
But when I try to run the application I get this error message:
No unique bean of type [org.springframework.security.authentication.ProviderManager] is defined:
expected single matching bean but found 2:
[org.springframework.security.authentication.ProviderManager#0, org.springframework.security.authenticationManager]
What could be the cause or how could I solve it?
I am using Spring Security 3.0.0-RC1 with Spring 3.0.1, and I've not defined any ProviderManager bean. I've succesfully used:
@Resource
private ProviderManager authenticationManager;
in other projects, but javax.annotation.Resource it is not supported in GAE.