spring mvc请求URL映射扫描两次

时间:2013-07-26 07:42:26

标签: spring spring-mvc

我正在使用组件扫描扫描所有控制器和注释配置以进行自动装配。 我也在使用mvc:annotation driven和tx:annotation-driven。我的网络应用程序运行正常,但在启动过程中所有请求映射都被扫描两次。我得到如下日志。

Mapped URL path [/mdm/searchDevice] onto handler 'mdmController'
2386 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO Mapped URL path [/mdm/searchDevice.*] onto handler 'mdmController'
2386 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO Mapped URL path [/mdm/searchDevice/] onto handler 'mdmController'
2760 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO org.apache.tiles.context.AbstractTilesApplicationContextFactory - Finished initializing Tiles2 application context.
2386 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO Mapped URL path [/mdm/searchDevice.*] onto handler 'mdmController'
2386 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO Mapped URL path [/mdm/searchDevice/] onto handler 'mdmController' 

/ mdm / searchDevice /被扫描两次。

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

    <context:component-scan base-package="com.tcs.mpos">
        <context:include-filter expression="org.springframework.stereotype.Controller"
            type="annotation" />
    </context:component-scan>

    <mvc:annotation-driven />

    <context:annotation-config />

    <tx:annotation-driven />

    <bean id="tilesViewResolver"
        class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <!-- <property name="order" value="0"/> -->
        <property name="viewClass">
            <value>
                org.springframework.web.servlet.view.tiles2.TilesView
            </value>
        </property>
    </bean>

    <bean id="tilesConfigurer"
        class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/tiles.xml</value>
            </list>
        </property>
    </bean>
</beans>

0 个答案:

没有答案