Hard?: Spring security on classes that are not Spring Beans?

Definitely need some expert help with this! I think this is mainly a Spring Security question, but as I don't know for sure, so I am also tagging with the general Spring tag!

When the Application Context is loaded (mine is all via Java Config, though I don't believe that matters), the "DefaultListableBeanFactory" is processed and eventually (via the ProxyFactory) Spring Security Advisors are added. This is great when I have Spring Beans as I have Permissions that need authorization.

My question is: how do I get the same effect when I no longer require those classes to be Spring Beans? Said differently, if I have an object instance created as a singleton bean via Java Config and the authorization is working correctly, is it possible to maintain that with the object instance being a POJO? Again, for the experts, I want the interception chain returned in the JdkDynamicAopProxy to contain the Spring Security interceptors.

And "no", I am not really expecting an answer to this, maybe just hoping!!!


To add security interceptors to beans not instantiated by spring container switch global-security tag to mode aspectj and weave the provided AnnotationSecurityAspect in the aspecj module.

For your second question I suppose that you want to do one of the following:

  • Use a ProxyFactoryBean to secure a bean.

  • Create security proxies programmatically: Use ProxyFactory.addAdvice() method.

  • Add the security interceptor to all proxies created by an AutoProxyCreator: This usually don't needed, but you can use the AbstractAutoProxyCreator.interceptorNames property to add common interceptors. The global-security tag parser uses a generated name for the MethodSecurityInterceptor, so you need to configure the interceptor manually and set a consistent SecurityMetadataSource.

Need Your Help

Calling MATLAB from Visual Studio in a loop and returning the result from MATLAB simulation through each iteration

matlab visual-studio

I am trying to invoke matlab from a loop in Visual Studio and run the simulation in MATLAB through each iteration. I want the result of the simulation in MATLAB to be passed back to visula studio u...

iPhone App design question, how to show detail view correctly

iphone ios uinavigationcontroller uitabbarcontroller uitabbar

I've been wrestling with this for a while. I need to show additional information about the current view (which is a detail view itself).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.