springmvc配置

本文详细介绍了如何使用 Spring MVC 开启注解驱动,解析静态文件,并配置文件上传,同时解释了如何实现管理员和用户登录拦截器,以及全局异常处理。此外,文章还涉及视图解析器的配置,确保了应用的高效性和安全性。
<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"
    xmlns:aop="http://www.springframework.org/schema/aop" 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.2.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.2.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
    
    <!-- 开启注解 -->
    <mvc:annotation-driven></mvc:annotation-driven>
    <!-- 解析静态文件 -->
    <mvc:default-servlet-handler />    
    <mvc:resources location="/admin/" mapping="/admin/**" />
    <mvc:resources location="/business/" mapping="/business/**" />
    <mvc:resources location="/css/" mapping="/css/**" />
    <mvc:resources location="/data/" mapping="/data/**" />
    <mvc:resources location="/dls/" mapping="/dls/**" />
    <mvc:resources location="/images/" mapping="/images/**" />
    <mvc:resources location="/js/" mapping="/js/**" />
    <mvc:resources location="/lib/" mapping="/lib/**" />
    <mvc:resources location="/news/" mapping="/news/**" />
    <mvc:resources location="/pages/" mapping="/pages/**" />
    <mvc:resources location="/*.html" mapping="/*.html" />
     
    <!-- 文件上传 设置上传最大尺寸,默认编码-->
    <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="maxUploadSize">
            <value>5242880</value>
        </property>
        <property name="defaultEncoding">
            <value>UTF-8</value>
        </property>
    </bean>
    
    <!--  避免返回为json类型出现下载的状况  -->    
    <bean id="mappingJacksonHttpMessageConverter"
        class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
        <property name="supportedMediaTypes">
            <list>
                <value>text/html;charset=UTF-8</value>
            </list>
        </property>
    </bean>
    
    <mvc:interceptors>    
    
        <!-- 管理员登陆拦截器 不包含某些路径,这里的 exclude 并不仅限于url,也可以是一个请求-->
        <mvc:interceptor>
            <mvc:mapping path="/post/admin/**"/>
            <mvc:exclude-mapping path="/post/admin/login"/>
            <mvc:exclude-mapping path="/post/admin/getSession"/>
            <bean class="com..interceptor.AdminSessionCheckInterceptor"/>
        </mvc:interceptor>
        <!-- 用户拦截器 -->
        <mvc:interceptor>    
            <mvc:mapping path="/post/**"/>
            <mvc:exclude-mapping path="/post/admin/**"/>
            <!-- <mvc:exclude-mapping path="/business/regInfo.html"/> -->
            <mvc:exclude-mapping path="/post/memberLogin"/>        <!-- 用户登录 -->
            <mvc:exclude-mapping path="/post/getMemberSession"/><!-- 获取session -->
            <mvc:exclude-mapping path="/post/checkMember"/>        <!-- 检查用户名是否存在 -->
            <mvc:exclude-mapping path="/business/regInfo.html"/><!-- 用户注册页面 -->
            <mvc:exclude-mapping path="/post/regist"/>            <!-- 用户注册请求 -->
            <mvc:exclude-mapping path="/post/uploadPic"/>
            <mvc:exclude-mapping path="/post/uploadTagExcelFile"/>
            <mvc:exclude-mapping path="/post/processUpload"/>    <!-- 不拦截 上传图片 -->
            <bean class="com.interceptor.MemberSessionCheckInterceptor"/><!--这里是进行session检查-->
        </mvc:interceptor>    
        
    </mvc:interceptors>
        
    <!-- 全局异常 需要实现 HandlerExceptionResolver 接口-->
    <bean class="com.exception.CommonsExceptionResolve" lazy-init="false"/>
    
    <!-- 视图解析器 -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
        <!-- 返回路径前缀 -->
        <property name="prefix" value="/"/>
        <!-- 返回路径后缀 可以是jsp注意前面有  "." -->
        <property name="suffix" value=".html"/>
    </bean>
    
</beans>


计及源荷不确定性的综合能源生产单元运行调度与容量配置优化研究(Matlab代码实现)内容概要:本文围绕“计及源荷不确定性的综合能源生产单元运行调度与容量配置优化”展开研究,利用Matlab代码实现相关模型的构建与仿真。研究重点在于综合能源系统中多能耦合特性以及风、光等可再生能源出力和负荷需求的不确定性,通过鲁棒优化、场景生成(如Copula方法)、两阶段优化等手段,实现对能源生产单元的运行调度与容量配置的协同优化,旨在提高系统经济性、可靠性和可再生能源消纳能力。文中提及多种优化算法(如BFO、CPO、PSO等)在调度与预测中的应用,并强调了模型在实际能源系统规划与运行中的参考价值。; 适合人群:具备一定电力系统、能源系统或优化理论基础的研究生、科研人员及工程技术人员,熟悉Matlab编程和基本优化工具(如Yalmip)。; 使用场景及目标:①用于学习和复现综合能源系统中考虑不确定性的优化调度与容量配置方法;②为含高比例可再生能源的微电网、区域能源系统规划设计提供模型参考和技术支持;③开展学术研究,如撰写论文、课题申报时的技术方案借鉴。; 阅读建议:建议结合文中提到的Matlab代码和网盘资料,先理解基础模型(如功率平衡、设备模型),再逐步深入不确定性建模与优化求解过程,注意区分鲁棒优化、随机优化与分布鲁棒优化的适用场景,并尝试复现关键案例以加深理解。
内容概要:本文系统分析了DesignData(设计数据)的存储结构,围绕其形态多元化、版本关联性强、读写特性差异化等核心特性,提出了灵活性、版本化、高效性、一致性和可扩展性五大设计原则。文章深入剖析了三类主流存储方案:关系型数据库适用于结构化元信息存储,具备强一致性与高效查询能力;文档型数据库适配半结构化数据,支持动态字段扩展与嵌套结构;对象存储结合元数据索引则有效应对非结构化大文件的存储需求,具备高扩展性与低成本优势。同时,文章从版本管理、性能优化和数据安全三个关键维度提出设计要点,建议采用全量与增量结合的版本策略、索引与缓存优化性能、并通过权限控制、MD5校验和备份机制保障数据安全。最后提出按数据形态分层存储的核心结论,并针对不同规模团队给出实践建议。; 适合人群:从事工业设计、UI/UX设计、工程设计等领域数字化系统开发的技术人员,以及负责设计数据管理系统架构设计的中高级工程师和系统架构师。; 使用场景及目标:①为设计数据管理系统选型提供依据,合理选择或组合使用关系型数据库、文档型数据库与对象存储;②构建支持版本追溯、高性能访问、安全可控的DesignData存储体系;③解决多用户协作、大文件存储、历史版本管理等实际业务挑战。; 阅读建议:此资源以实际应用场景为导向,结合具体数据库类型和表结构设计进行讲解,建议读者结合自身业务数据特征,对比分析不同存储方案的适用边界,并在系统设计中综合考虑成本、性能与可维护性之间的平衡。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值