In the latter case security:http element might not be the part of the xml schema defined. So, its likely to get exception. By the way, what exception?
Up vote 0 down vote favorite share g+ share fb share tw.
I have written a small webapp using spring-security and spring-mvc with an annotation based configuration (@Secured). In order to have that work I had to split up the spring-security configuration: app-context. Xml (included in web.
Xml's ContextConfigLocation) app-servlet. Xml (spring-mvc's dispatcherservlet loads this) Why did I have to split these up? When I put all the security configuration in app-context.
Xml the @Secured annotations seem to be ignored, so you don't need to be logged in to access the @Secured Controller methods. When I put it all in app-servlet. Xml the following Exception is raised... org.springframework.beans.factory.
NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined at org.springframework.beans.factory.support. DefaultListableBeanFactory. GetBeanDefinition(DefaultListableBeanFactory.
Java:504) at org.springframework.beans.factory.support. AbstractBeanFactory. GetMergedLocalBeanDefinition(AbstractBeanFactory.
Java:1041) at org.springframework.beans.factory.support. AbstractBeanFactory. DoGetBean(AbstractBeanFactory.
Java:273) at org.springframework.beans.factory.support. AbstractBeanFactory. GetBean(AbstractBeanFactory.
Java:193) at org.springframework.context.support. AbstractApplicationContext. GetBean(AbstractApplicationContext.
Java:1008) at org.springframework.web.filter. DelegatingFilterProxy. InitDelegate(DelegatingFilterProxy.
Java:217) at org.springframework.web.filter. DelegatingFilterProxy. InitFilterBean(DelegatingFilterProxy.
Java:145) at org.springframework.web.filter. GenericFilterBean. Init(GenericFilterBean.
Java:179) I don't get it :/ java spring spring-mvc spring-security link|improve this question edited Jan 22 '10 at 15:00 asked Jan 22 '10 at 3:49fas3,298829 89% accept rate.
In the latter case, element might not be the part of the xml schema defined. So, its likely to get exception. By the way, what exception?
In the former case, it didn't work. May be because Spring looks for this element in the xml config loaded by DispatcherServlet, otherwise ignore it. I am not sure either, but it seems like it.
:) Look at this spring forum thread. They are discussing the same. To sum it up, "the *-servlet.
Xml beans aren't visible from the main context".
I added the Exception to my question – fas Jan 22 '10 at 15:02.
Must be declared in the configContextLocation's config. It can not be declared in ...-servlet. Xml, because during the request processing it should be available before the target servlet is identified.
(as far as I understand) registers a bean postprocessor, which is applied to the context where it is declared (i.e. When declared in the configContextLocation's xml, it is applied to the beans declared there, but not to the beans declared in ...-servlet. Xml).
In Virgo, the main configuration is defined by org.eclipse.virgo.web.dm. ServerOsgiBundleXmlWebApplicationContext in the web. Xml, so I had to import the security config into the applicationContext.
Xml instead of *-servlet. Xml that fixed the No bean named 'springSecurityFilterChain' is defined.
You should be able to have both in one XML, just make sure the schema is declared properly. I have used them in same file in both Spring 2.5 and Spring 3. When you say it don't work when in both file, I assume you mean that no security is applied to your method calls?
If that is the case, make sure that your application loads and uses these classes via spring, if not no security will be applied. E.g. If you access a class as: MyClass instance = new MyClass(); instance.doSomething(); if doSomething() is annotated with security annotations, nothing will react on that annotation.
The same goes if your using it from a servlet not being injected via spring etc. If this is not helpful, could you clarify your problems?
No the annotated methods get called by spring-mvc via @RequetMapping – fas Jan 22 '10 at 12:56.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.