По-долу съм поставил моя сървлет-context.xml.Получавам грешката в пролетен инструмент в реда, където съм обявявал маркер, задвижван от анотация
cvc-complex-type.2.4.a: Invalid content was found starting with element "annotation-driven". One of "{"http://www.springframework.org/schema/beans":description, "http://
www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean,
WC[##other:"http://www.springframework.org/schema/beans"]}" is expected.
<?xml version="1.0" encoding="utf-8"?>
<beans:beans xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- DispatcherServlet Context: defines this servlet"s request-processing infrastructure -->`enter code here`
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<beans:bean id="productManager" class="com.manthan.service.SimpleProductManager">
<beans:property name="products">
<beans:list>
<beans:ref bean="product1"/>
<beans:ref bean="product2"/>
<beans:ref bean="product3"/>
</beans:list>
</beans:property>
</beans:bean>
<context:component-scan base-package="com.manthan.vani" />
</beans:beans>
Аз съм начинаещ и работим върху прозореца на пролетния инструмент 3.7.0
Отговори:
3 за отговор № 1Промяна:
xmlns:mvc="http://www.springframework.org/schema/mvc"
да се
xmlns="http://www.springframework.org/schema/mvc"
или направете:
<mvc:annotation-driven />
Вашата правилна конфигурация има префикс "mvc", който не сочи към стандартното пространство на имена и annotation-driven
идва от mvc схема.