src/main/resources/spring/springmvc.xml

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?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:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="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.xsd
	http://www.springframework.org/schema/aop
	http://www.springframework.org/schema/aop/spring-aop.xsd
	http://www.springframework.org/schema/tx
	http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <!--加载静态资源-->
<!--    <mvc:resources location="/static/" mapping="/static/login/**" />-->
    <mvc:resources location="/static/" mapping="/static/**" />
<!--    <mvc:resources location="/static/" mapping="/static/font/**" />-->
<!--    <mvc:resources location="/static/" mapping="/static/lib/**" />-->
    <mvc:default-servlet-handler/>

    <!--组件扫描,可以扫描 controller、Service、...
    并注册添加到 spring 容器中
    这里扫描 controller,指定controller的包
    -->
    <context:component-scan base-package="com.mty.cc.controller"/>

    <!--视图解析器-->
    <!--
    需要配置解析jsp的视图解析器
    jsp解析,默认使用jstl标签解析
    -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <!--拼接视图地址的前缀和后缀-->
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

    <!--拦截器-->
    <mvc:interceptors>
        <mvc:interceptor>
            <mvc:mapping path="/**"/>
            <mvc:exclude-mapping path="/static/**"/>
            <mvc:exclude-mapping path="/index/**"/>
<!--            <mvc:exclude-mapping path="/index/register" />-->
            <bean class="com.mty.cc.interceptor.MtyInterceptor" />
        </mvc:interceptor>
    </mvc:interceptors>

    <!--配置异常处理器-->
    <bean id="mtyExceptionResolver" class="com.mty.cc.exception.MtyExceptionResolver"/>

    <!-- 开启SpringMVC框架注解的支持 -->
    <!--使用annotation-driven 注解驱动,就可以代替 注解映射器 和 注解适配器 的配置-->
    <!--conversion-service 向处理器适配器中注入【自定义的参数绑定组件】。-->
    <mvc:annotation-driven />

    <!-- 定义文件上传解析器 -->
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
后面还有 7 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。