Я создал простой динамический проект c без maven в затмении. Только когда я использую контекст тега: компонент-сканирование, я сталкиваюсь с ошибкой ниже в файле диспетчера Spring: -
schema_reference.4: не удалось прочитать документ схемы 'https://www.springframework.org/schema/beans/spring-beans-4.3.xsd', потому что 1 ) не смог найти документ; 2) документ не может быть прочитан; 3) элемент root документа не является.
Не уверен, откуда упоминается версия 4.3. Я использую весеннюю версию 5.0.0.RELEASE и добавил все фляги в lib. Ниже приведено содержимое файла диспетчера пружин: -
<?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:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.example.controller"/> </beans>
Я не могу найти решение этой проблемы. Подходящая помощь будет оценена.
Есть много возможностей для этой проблемы.
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:ctx="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd "> <ctx:annotation-config></ctx:annotation-config> <ctx:component-scan base-package="com.*"></ctx:component-scan>