문제

We are using JOSSO framework for single sign on. It is working properly in Spring 2.5.6. It seems strict XML schema validation is introduced in Spring 3, JOSSO XSD's are not updated since long time, hence we get errors during startup of server. Is there any way to disable Schema Validation in Spring 3 (Probably make it work similar to 2.5.6)..

도움이 되었습니까?

해결책

I have not tried it yet, but the GenericXmlApplicationContext has a setValidating(boolean validating) method.

I believe you can use this method to deactivate the validation:

GenericXmlApplicationContext context = new GenericXmlApplicationContext();
context.setValidating(false);
context.load("myResource.xml", "otherResource.xml");
context.refresh();

https://jira.springframework.org/browse/SPR-5014

If you use spring in a web application then it is more difficult to set the validation parameter. One way I can think of, based on the fact that the ContextLoader uses an web.xml context parameter "contextClass" to specify the context class (default is: org.springframework.web.context.support.XmlWebApplicationContext).

  • @see: org.springframework.web.context.ContextLoader
  • @see: org.springframework.web.context.ContextLoader#determineContextClass(ServletContext)

Maybe you can create a Subclass of XmlWebApplicationContext with disabled validation and use the "contextClass" parameter to load this class instead of XmlWebApplicationContext.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top