当我使用eclipse在3月2日在我自己的电脑上创建我的项目时,我没有问题,但是当我将eclipse从我的PC移动到桌面时,我在security-config.xml上收到了一条错误消息:
错误消息:
Multiple annotations found at this line:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'security:http'.
- Start tag of element <security:http>
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/security/spring-
security.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is
not <xsd:schema>.
我的security-config.xml文件是:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
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">
<security:http auto-config="true">
<security:form-login login-page="/app/main" default-target-url="/app/account" />
<security:logout logout-url="/app/logout" logout-success-url="/app/main" />
</security:http>
<security:authentication-manager>
<security:authentication-provider user-service-ref="userServices">
<security:password-encoder hash="md5" />
</security:authentication-provider>
</security:authentication-manager>
<bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<property name="userDetailsService" ref="userServices" />
<property name="hideUserNotFoundExceptions" value="false" />
</bean>
<bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
<constructor-arg>
<ref bean="daoAuthenticationProvider" />
</constructor-arg>
</bean>
</beans>
有关我的笔记本电脑的更多详细信息,它可以完美运行
答案 0 :(得分:0)
查看http://www.springframework.org/schema/security/
您可能只需要添加正在使用的spring安全性的版本号。也许你的笔记本电脑有一个旧的版本缓存,他们从他们的网站删除了无版本的。
这个应该工作: http://www.springframework.org/schema/security/spring-security-4.1.xsd