AspectJ Advice on Spring Security ProviderManager throws exception on startup

Does anyone know why when I try to create an advice around the "doAuthentication" method of the Spring Security (v3.0) ProviderManager my application throws an exception on startup?

I am autowiring an instance of my spring authentication-manager bean into a controller and when the autowire is attempted my app fails to deploy.

Here is what my security context xml looks like...

...<authentication-manager alias="authenticationManager"> ...

Here is the pertinent part of my controller...

private ProviderManager authenticationManager;

and here is my advice declaration:

@After("execution(* && args(authentication)")

Any help will be greatly appreciated!


I'm not sure from the available information, but I'm guessing that you're using Spring AOP, which uses JDK dynamic proxies by default, so you are coming across the usual problem that the proxy does not retain the type of the original class (ProviderManager). The proxy will implement the interface AuthenticationManager, however. Try autowiring using this type and see if it works. Either that or you can enable class proxying which uses cglib instead of dynamic proxies. If you're using the Spring AOP namespace, you can set the proxy-target-class attribute to true.

Need Your Help

Problem implementing generic interface

c# generics inheritance

I have a base DLL which defines some basic structure and operation for a key concept within our business. This dll is then included in specific web services for each vendor that implement the speci...

Calculate mean reaction time only for correct trials

r mean

I have found that someone else has a similar problem here. But I am very new to programming and to R and I don't understand how I can adapt the answers to my situation. My data looks like what the