使用xml和javaconfig的Spring安全性配置

时间:2016-03-16 10:16:11

标签: spring

我的应用程序中的其他地方没有spring-security.xsd。我只在security-config.xml文件中使用它。请看我的架构xsd,虽然我从spring-security.xsd中删除了该版本,但我没有找到为什么我仍然遇到错误。

Spring Version是4.2.2 RELEASE Spring Security是4.0.3 RELEASE。

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:security="http://www.springframework.org/schema/security"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
                        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
                        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

控制台中的错误

INFO   (org.springframework.web.context.ContextLoader:307) - Root WebApplicationContext: initialization started
INFO   (org.springframework.web.context.support.AnnotationConfigWebApplicationContext:574) - Refreshing Root WebApplicationContext: startup date [Wed Mar 16 19:07:14 IST 2016]; root of context hierarchy
INFO   (org.springframework.web.context.support.AnnotationConfigWebApplicationContext:243) - Found 3 annotated classes in package [com.jbent.peoplecentral.config]
INFO   (org.springframework.beans.factory.xml.XmlBeanDefinitionReader:317) - Loading XML bean definitions from class path resource [config/web-application-config.xml]
INFO   (org.springframework.beans.factory.xml.XmlBeanDefinitionReader:317) - Loading XML bean definitions from class path resource [config/data-access-config.xml]
INFO   (org.springframework.beans.factory.xml.XmlBeanDefinitionReader:317) - Loading XML bean definitions from class path resource [config/webmvc-config.xml]
INFO   (org.springframework.beans.factory.xml.XmlBeanDefinitionReader:317) - Loading XML bean definitions from class path resource [config/security-config.xml]
INFO   (org.springframework.security.core.SpringSecurityCoreVersion:59) - You are running with Spring Security Core 4.0.3.RELEASE
INFO   (org.springframework.security.config.SecurityNamespaceHandler:78) - Spring Security 'config' module version is 4.0.3.RELEASE
WARN   (org.springframework.web.context.support.AnnotationConfigWebApplicationContext:544) - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [security-config.xml]
Offending resource: class path resource [config/web-application-config.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd or spring-security-3.1.xsd schema or spring-security-3.2.xsd schema with Spring Security 4.0. Please update your schema declarations to the 4.0 schema.
Offending resource: class path resource [config/security-config.xml]
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)

0 个答案:

没有答案