mvc:注释驱动的原因404

时间:2015-10-04 12:12:11

标签: spring spring-mvc tomcat

如果我添加

<mvc:annotation-driven />

到我的applicationContext.xml,它会导致我的Tomcat 8出现404错误。

什么是原因,如何在Tomcat 8上调试此问题?是否有任何日志可以帮助解决问题?

我的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:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
 http://www.springframework.org/schema/mvc 
 http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
 http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
 http://www.springframework.org/schema/context 
 http://www.springframework.org/schema/context/spring-context-4.0.xsd">

    <context:component-scan base-package="pl.kobietydokodu" />
    <context:annotation-config /> 
    <mvc:annotation-driven /> <!-- this cause 404 -->

    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix">
            <value>/WEB-INF/views/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>

</beans>

我使用Gradle来依赖管理。

0 个答案:

没有答案