| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?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:mvc="http://www.springframework.org/schema/mvc"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:task="http://www.springframework.org/schema/task"
- xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
- http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.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-4.3.xsd">
- <!-- 配置注解驱动 -->
- <mvc:annotation-driven>
- <mvc:message-converters>
- <bean
- class="org.springframework.http.converter.StringHttpMessageConverter">
- <property name="supportedMediaTypes">
- <list>
- <value>application/json;charset=UTF-8</value>
- <value>text/html;charset=UTF-8</value>
- </list>
- </property>
- </bean>
- <!-- 启动JSON格式的配置,自动将格式转换成JSON格式,不需要其他类 -->
- <bean id="jacksonMessageConverter"
- class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
- <property name="supportedMediaTypes"
- value="application/json;charset=UTF-8" />
- </bean>
- </mvc:message-converters>
- </mvc:annotation-driven>
- <!-- 配置包扫描器 -->
- <context:component-scan base-package="com.ncjt.ch.sm.controller"></context:component-scan>
- <context:component-scan base-package="com.ncjt.ch.eg.api.device.controller"></context:component-scan>
- <context:component-scan base-package="com.ncjt.ch.eg.qrcode.controller"></context:component-scan>
-
- <!-- 配置spring定时任务 -->
- <context:component-scan base-package="com.ncjt.ch.eg.component"></context:component-scan>
- <task:scheduler id="scheduler" pool-size="3"/>
- <task:scheduled-tasks scheduler="scheduler">
- <task:scheduled ref="simpleTask" method="weiXiaoVisitor" cron="10 * * * * ?"/>
- <!-- <task:scheduled ref="simpleTask" method="schoolGateRecordUpload" cron="10 * * * * ?"/>-->
- <task:scheduled ref="simpleTask" method="schoolGateRecordUpload" cron="0 15 10 * * ?" />
- </task:scheduled-tasks>
- <!-- 视图解析器 -->
- <bean
- class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="prefix" value="/WEB-INF/JSP/" />
- <property name="suffix" value=".jsp" />
- </bean>
- <!-- 注册multipart解析器,这个id是固定的,由DispatcherServlet直接调用 -->
- <bean id="multipartResolver"
- class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
- <property name="defaultEncoding" value="utf-8" />
- <property name="maxUploadSize" value="10240000"></property>
- <!-- 改属性延迟解析,当进入Controller时开始解析,这样就可以捕获到异常,否则由SpringMVC抛出异常时无法捕获 -->
- <property name="resolveLazily" value="true"></property>
- </bean>
- <!-- 对静态资源文件请求的映射,否则客户端无法得到js文件和css文件 -->
- <!-- 将/js/**的所有请求链接映射到/WEB-INF/js/目录下,即在/WEB-INF/js/目录 -->
- <!-- 下查找请求的js文件和css文件 -->
- <mvc:resources location="/WEB-INF/css/" mapping="/css/**"></mvc:resources>
- <mvc:resources location="/WEB-INF/image/"
- mapping="/image/**"></mvc:resources>
- <mvc:resources location="/WEB-INF/jub/" mapping="/jub/**"></mvc:resources>
- <mvc:resources location="/WEB-INF/js/" mapping="/js/**"></mvc:resources>
- <mvc:resources location="/WEB-INF/static/" mapping="/static/**"></mvc:resources>
- <mvc:resources location="/WEB-INF/uploadImages/"
- mapping="/uploadImages/**"></mvc:resources>
- <mvc:resources location="/WEB-INF/showImages/"
- mapping="/showImages/**"></mvc:resources>
- <mvc:resources location="/download/" mapping="/download/**"></mvc:resources>
- <!-- 这个配置可以替代上面的配置, -->
- <!-- 区别在于,这时Spring MVC会直接使用请求的链接作为文件的位置, -->
- <!-- 而不能使用映射后的文件位置 -->
- <!-- <mvc:default-servlet-handler /> -->
- <!-- 配置拦截器,用于解决AJAX跨域问题 -->
- <!-- <mvc:interceptors> -->
- <!-- <mvc:interceptor> -->
- <!-- <mvc:mapping path="/**" /> -->
- <!-- <bean class="com.jgxl.eid.interceptor.CommonInterceptor"> -->
- <!-- <property name="excludedUrls"> -->
- <!-- <list> -->
- <!-- <value>/</value> -->
- <!-- </list> -->
- <!-- </property> -->
- <!-- </bean> -->
- <!-- </mvc:interceptor> -->
- <!-- </mvc:interceptors> -->
- <!-- 配置拦截器 -->
- <!-- <mvc:interceptors> -->
- <!-- <mvc:interceptor> -->
- <!-- <mvc:mapping path="/*" /> -->
- <!-- <mvc:exclude-mapping path="/" /> -->
- <!-- <mvc:exclude-mapping path="/test"/> -->
- <!-- <bean class="com.plk.jdz.interceptor.SessionIdCheckInterceptor"> -->
- <!-- <property name="excludedUrls"> -->
- <!-- <list> -->
- <!-- <value>/checkLogin</value> -->
- <!-- </list> -->
- <!-- </property> -->
- <!-- </bean> -->
- <!-- </mvc:interceptor> -->
- <!-- </mvc:interceptors> -->
- <!-- 配置异常处理器 -->
- <!-- <bean id="handlerExceptionResolver" -->
- <!-- class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> -->
- <!-- <property name="exceptionMappings"> -->
- <!-- <props> -->
- <!-- <prop key="com.plk.jdz.exception.NotLoggedException">redirect:/</prop> -->
- <!-- </props> -->
- <!-- </property> -->
- <!-- </bean> -->
- </beans>
|