gpt4 book ai didi

java - 匹配的通配符是严格的,但找不到元素 'context:annotation-config' 的声明

转载 作者:行者123 更新时间:2023-12-05 03:12:14 26 4
gpt4 key购买 nike

我的代码:我已正确配置 XML,添加了所有架构,但仍然出现错误。

配置.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
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-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/spring-context-3.2.xsd"
xmlns:context="http://www.springframework.org/schema/context">
<context:annotation-config />
<context:component-scan base-package="com"/>
<bean id="bean1" class="com.pojos.BookInfo">
</bean>
</beans>

最佳答案

您在为 xmlns:context="http://www.springframework.org/schema/context" 命名空间指定 XSD 的位置时出错:

替换

http://www.springframework.org/schema/spring-context-3.2.xsd

http://www.springframework.org/schema/context/spring-context-3.2.xsd

总计:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
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-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd"
xmlns:context="http://www.springframework.org/schema/context">
<context:annotation-config />
<context:component-scan base-package="com"/>
<bean id="bean1" class="com.pojos.BookInfo">
</bean>
</beans>

关于java - 匹配的通配符是严格的,但找不到元素 'context:annotation-config' 的声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34437023/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com