我有以下条目
web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml /WEB-INF/spring-security.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
的applicationContext:
<bean id="myUserDAO" class="no.java.UserDAOImpl">
<property name="DataSource" ref="myDataSource"/>
</bean>
在spring-security.xml中 我有以下条目:
<beans:bean id="myUserDetailsService" class="no.java.SimpleUserDetailsService" >
<property name="UserDAO" ref="myUserDAO" />
</bean>
现在我正在接受错误
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from ServletContext resource [/WEB-INF/spring-security.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 56; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'property'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
据我所知,我应该得到像bean myUserDAO undefined或类似的东西,但我不是。我真的非常感谢任何帮助,因为我现在正在享受这个错误很长时间。
答案 0 :(得分:3)
您的XML格式不正确,
<beans:bean id="myUserDetailsService" class="no.java.SimpleUserDetailsService" >
<property name="UserDAO" ref="myUserDAO" />
</bean>
应该是
<beans:bean id="myUserDetailsService" class="no.java.SimpleUserDetailsService" >
<beans:property name="UserDAO" ref="myUserDAO" />
</beans:bean>