spring-mvc.xml文件的配置(官方文件)

来源:互联网 发布:数据魔方 免费 编辑:程序博客网 时间:2024/06/05 20:18
 <?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"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/mvc
 http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
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-3.1.xsd">
<!-- 开启注解 -->
<context:annotation-config/>
<!-- 开启mvc的注解驱动 -->
<mvc:annotation-driven/>
<!-- 自动扫描controller包下的所有类,使其认为spring mvc的控制器 -->
<context:component-scan base-package="com.yjf.controller"/>
<!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/" p:suffix=".jsp"/>
<!--另一种复杂写法
<property name="prefix" value="/jsp/"></property>
     <property name="suffix" value=".jsp"></property>
        -->
<!--由于以上配置已经能够解决问题,所以以下我未使用过-->
<mvc:default-servlet-handler/>
     <context:property-placeholder location="classpath:swagger.properties" />
     <context:component-scan base-package="com.mangofactory.swagger.springmvc.example" />
     <bean id="documentationConfig" class="com.mangofactory.swagger.springmvc.example.config.CustomDocumentationConfig"/>
     <bean id="extensibilityModule" class="com.mangofactory.swagger.springmvc.example.config.ExampleExtensibilityModule" />
</beans> 
0 0
原创粉丝点击