Tôi nhận được các lỗi sau đây trong khi cố gắng dự án mùa xuân đầu tiên của tôi:Các ký tự đại diện phù hợp là nghiêm ngặt, nhưng không có tuyên bố có thể được tìm thấy cho yếu tố 'bối cảnh: thành phần quét
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan
Đây là applicationContext.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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:component-scan base-package="com.xyz" />
</beans>
Điều gì gây ra lỗi?
Vấn đề của tôi là tôi đã chỉ định * sai * vị trí lược đồ.Kiểm tra kỹ hơn hoặc sao chép/dán từ đây. – vadipp
Lỗi bị biến mất CHỈ khi đặt "xmlns: context" hiện tại ngay trước thông số "xsi: schemaLocation". Thanx cho đề xuất. – tjm1706