zoukankan      html  css  js  c++  java
  • spring mvc 配置文件信息记录

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    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.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
    <!-- 自动扫描包名,扫描指定的包中的类上的注解 -->
    <context:component-scan base-package="cn.ct.em.*.controller, cn.ct.em.v3.*.controller" use-default-filters="false">
    <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />

    <!-- </context:component-scan>不仅可以完成 <context:annotation-config>一样的工作。

    (<context:annotation-config>有助于完善Spring配置中的<Property>和<constructor-arg>元素,但是<bean>仍需显示定义 )

      </context:component-scan>而且会自动扫描指定的包(cn.ct.em.*.controller, cn.ct.em.v3.*.controller)并查找出能够自动注册为Spring Bean的类

    -->

    </context:component-scan>

    <!-- sping mvc 为@Controllers分发请求所必须的,并提供了数据绑定支持,读写XML支持,读写JSON的支持

      可以替换成<mvc:annotation-driven />自动的会自动注册DefaultAnnotationHandlerMapping与AnnotationMethodHandlerAdapter 两个bean  

      并提供了:数据绑定支持,@NumberFormatannotation支持,@DateTimeFormat支持,@Valid支持,读写XML的支持(JAXB),读写JSON的支持(Jackson)

     -->
    <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" />
    <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />

    <!-- 对静态资源文件的访问使用默认的servlet来响应

      

           Tomcat, Jetty, JBoss, and GlassFish 自带的默认Servlet的名字 -- "default"
      Google App Engine 自带的 默认Servlet的名字 -- "_ah_default"
      Resin 自带的 默认Servlet的名字 -- "resin-file"
      WebLogic 自带的 默认Servlet的名字 -- "FileServlet"
      WebSphere 自带的 默认Servlet的名字 -- "SimpleFileServlet"

    -->
    <mvc:default-servlet-handler />
    <!-- 视图解释类 -->
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/page/"></property>
    <property name="suffix" value=".jsp"></property>
    </bean>

    </beans>

  • 相关阅读:
    Jenkins发布遇到的问题
    js相关问题总结
    代码洁癖症轻度患者-页面显示状态判断解决方案
    eclipse没有打断点,项目确仍然要进入断点的问题。
    liunx新装tomcat之后,tomcat不能识别新发布的项目
    phpstorm+xdebug单步调试的配置
    laravel 路由前缀,路由名称前缀区别
    Specified key was too long ... 767 bytes
    postman 自动化测试
    Linux top输出st 的值过高导致系统负载过高
  • 原文地址:https://www.cnblogs.com/wang985850293/p/5631823.html
Copyright © 2011-2022 走看看