前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SSM项目搭建二(终) 原

SSM项目搭建二(终) 原

作者头像
尚浩宇
发布2018-08-17 10:00:10
2670
发布2018-08-17 10:00:10
举报
文章被收录于专栏:杂烩杂烩

applicationContext.xml

代码语言:javascript
复制
<?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:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc 
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"
	default-lazy-init="true">
	<!--使Spring支持自动检测组件,如注解的Controller -->
	<context:component-scan base-package="com.cmicroentropy.soa.controller" />

	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver"
		p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />
	<bean id="mappingJacksonHttpMessageConverter"
		class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
		<property name="supportedMediaTypes">
			<list>
				<value>application/json;charset=UTF-8</value>
			</list>
		</property>
	</bean>
	<bean
		class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
	<bean
		class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
		<property name="messageConverters">
			<list>
				<bean id="utf8StringHttpMessageConverter"
					class="com.cmicroentropy.soa.util.converter.UTF8StringHttpMessageConverter" />
					<ref bean="mappingJacksonHttpMessageConverter" />
			</list>
		</property>
	</bean>
	<!-- SpringMVC上传文件时,需要配置MultipartResolver处理器 -->
	<bean id="multipartResolver"
		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="defaultEncoding" value="UTF-8" />
		<!-- 指定所上传文件的总大小不能超过200KB。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件的容量之和 -->
		<property name="maxUploadSize" value="5000000" />
	</bean>
	<!-- SpringMVC在超出上传文件限制时,会抛出org.springframework.web.multipart.MaxUploadSizeExceededException -->
	<!-- 该异常是SpringMVC在检查上传的文件信息时抛出来的,而且此时还没有进入到Controller方法中 <bean id="exceptionResolver" 
		class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> 
		<property name="exceptionMappings"> <props> -->
	<!-- 遇到MaxUploadSizeExceededException异常时,自动跳转到/WEB-INF/jsp/error_fileupload.jsp页面 
		<prop key="org.springframework.web.multipart.MaxUploadSizeExceededException">error_fileupload</prop> 
		</props> </property> </bean> -->
	<!-- 启动 Spring MVC 的注解功能,完成请求和注解 POJO 的映射 -->
	<context:annotation-config />
</beans>

applicationContext-quartz.xml

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:task="http://www.springframework.org/schema/task"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop-4.0.xsd 
    http://www.springframework.org/schema/tx  
    http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
    http://www.springframework.org/schema/context
     http://www.springframework.org/schema/context/spring-context-4.0.xsd 
     http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.0.xsd
">
	<!-- 定时器开关 开始 -->
	<task:annotation-driven />
	<!-- 定时器开关 结束 -->
	<bean id="V3Timer" class="com.cmicroentropy.soa.timer.V3Timer"></bean> 
	<task:scheduled-tasks>  
		<!-- 每天早上六点,中午十二点,下午八点清除一次缓存内脏数据  0 0 0,6,12,18 * * ?-->
       	<task:scheduled ref="V3Timer" method="clearOverdueCache" cron="0 0 0,6,12,18 * * ?" />  
       	<task:scheduled ref="V3Timer" method="clearPicTemp" cron="0 0 23 * * ?" />
		<task:scheduled ref="V3Timer" method="genBuildingReport" cron="0 0 0 1 * ?" />
       	<!-- <task:scheduled ref="V3Timer" method="clearPicTemp" cron="0/10 * * * * ?" /> -->
   	</task:scheduled-tasks>
</beans>

spring-mvc.xml

代码语言:javascript
复制
<?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:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc 
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"
	default-lazy-init="true">
	<!--使Spring支持自动检测组件,如注解的Controller -->
	<context:component-scan base-package="com.cmicroentropy.soa.controller" />

	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver"
		p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />
	<bean id="mappingJacksonHttpMessageConverter"
		class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
		<property name="supportedMediaTypes">
			<list>
				<value>application/json;charset=UTF-8</value>
			</list>
		</property>
	</bean>
	<bean
		class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
	<bean
		class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
		<property name="messageConverters">
			<list>
				<bean id="utf8StringHttpMessageConverter"
					class="com.cmicroentropy.soa.util.converter.UTF8StringHttpMessageConverter" />
					<ref bean="mappingJacksonHttpMessageConverter" />
			</list>
		</property>
	</bean>
	<!-- SpringMVC上传文件时,需要配置MultipartResolver处理器 -->
	<bean id="multipartResolver"
		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="defaultEncoding" value="UTF-8" />
		<!-- 指定所上传文件的总大小不能超过200KB。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件的容量之和 -->
		<property name="maxUploadSize" value="5000000" />
	</bean>
	<!-- SpringMVC在超出上传文件限制时,会抛出org.springframework.web.multipart.MaxUploadSizeExceededException -->
	<!-- 该异常是SpringMVC在检查上传的文件信息时抛出来的,而且此时还没有进入到Controller方法中 <bean id="exceptionResolver" 
		class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> 
		<property name="exceptionMappings"> <props> -->
	<!-- 遇到MaxUploadSizeExceededException异常时,自动跳转到/WEB-INF/jsp/error_fileupload.jsp页面 
		<prop key="org.springframework.web.multipart.MaxUploadSizeExceededException">error_fileupload</prop> 
		</props> </property> </bean> -->
	<!-- 启动 Spring MVC 的注解功能,完成请求和注解 POJO 的映射 -->
	<context:annotation-config />
</beans>

oscache.properties

代码语言:javascript
复制
cache.memory=true
cache.path=D:\\cache
cache.algorithm=com.opensymphony.oscache.base.algorithm.FIFOCache
cache.blocking=true
cache.persistence.class=com.opensymphony.oscache.plugins.diskpersistence.DiskPersistenceListener
cache.persistence.overflow.only=true
cache.capacity=1000
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2015/05/05 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档