spring applicationContext.xml

来源:互联网 发布:nginx源码阅读 编辑:程序博客网 时间:2024/04/19 23:12
<?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"xsi:schemaLocation="     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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 "default-lazy-init="true"><!--注解说明 --><context:annotation-config /><!-- 设置需要进行Spring注解扫描的类包 --><context:component-scan base-package="com"><context:exclude-filter type="annotation"expression="org.springframework.stereotype.Controller" /></context:component-scan><context:component-scan base-package="com"><context:exclude-filter type="annotation"expression="org.springframework.stereotype.Controller" /></context:component-scan><!-- JDBC参数配置 --><beanclass="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"lazy-init="true"><property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /><property name="ignoreResourceNotFound" value="true" /><property name="location" value="classpath:/jdbc.properties" /></bean><!-- 数据源配置 --><bean id="dataSource"class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy"><property name="targetDataSource"><bean class="org.logicalcobwebs.proxool.ProxoolDataSource"><property name="alias" value="hotstreet" /><property name="driver" value="${driver}" /><property name="driverUrl" value="${driverUrl}" /><property name="user" value="${user}" /><property name="password" value="${password}" /><property name="prototypeCount" value="${prototypeCount}" /><property name="simultaneousBuildThrottle" value="${simultaneousBuildThrottle}" /><property name="maximumConnectionCount" value="${maximumConnectionCount}" /><property name="minimumConnectionCount" value="${minimumConnectionCount}" /><property name="maximumActiveTime" value="${maximumActiveTime}" /></bean></property></bean><!-- jdbcTemplate配置 --><bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"><property name="dataSource"><ref bean="dataSource" /></property></bean><!-- 配置一个NamedParameterJdbcTemplate模板 使用构造函数注入器 --><bean id="namedParameterJdbcTemplate"class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate"><constructor-arg ref="dataSource" /></bean><!-- 配置JDBC事务管理器 --><bean id="txManager"class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource" /></bean><!-- 配置事务传播特性 --><tx:advice id="txAdvice" transaction-manager="txManager"><tx:attributes><tx:method name="save*" propagation="REQUIRED" /><tx:method name="pay*" propagation="REQUIRED" /><tx:method name="add*" propagation="REQUIRED" /><tx:method name="create*" propagation="REQUIRED" /><tx:method name="insert*" propagation="REQUIRED" /><tx:method name="update*" propagation="REQUIRED" /><tx:method name="merge*" propagation="REQUIRED" /><tx:method name="del*" propagation="REQUIRED" /><tx:method name="remove*" propagation="REQUIRED" /><tx:method name="put*" propagation="REQUIRED" /><tx:method name="get*" propagation="SUPPORTS" read-only="true" /><tx:method name="count*" propagation="SUPPORTS" read-only="true" /><tx:method name="find*" propagation="SUPPORTS" read-only="true" /><tx:method name="list*" propagation="SUPPORTS" read-only="true" /><tx:method name="*" propagation="SUPPORTS" read-only="true" /><tx:method name="batchSaveOrUpdate" propagation="REQUIRES_NEW" /></tx:attributes></tx:advice><!-- 配置AOP --><aop:config><aop:pointcut id="txPointcut"expression="execution(* com.service.*.*(..))" /><aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut" /></aop:config><!-- Jackson全局配置,在*-servlet.xml中为Jackson转换器指定该Bean,在程序中需要的地方直接注入使用 --><bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"><property name="serializationInclusion" value="NON_NULL" /><property name="dateFormat"><bean class="java.text.SimpleDateFormat"><constructor-arg value="yyyy-MM-dd HH:mm:ss" /></bean></property></bean><bean id="messageSource"class="org.springframework.context.support.ReloadableResourceBundleMessageSource"><property name="cacheSeconds" value="3600" /><property name="useCodeAsDefaultMessage" value="true" /><property name="basenames"><list><value>/WEB-INF/language/common/message</value><value>/WEB-INF/language/admin/message</value><value>/WEB-INF/language/shop/message</value></list></property></bean><bean id="localeResolver"class="org.springframework.web.servlet.i18n.FixedLocaleResolver"><property name="defaultLocale" value="zh_CN" /></bean><bean id="taskExecutor"class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"><property name="corePoolSize" value="5" /><property name="maxPoolSize" value="50" /><property name="queueCapacity" value="1000" /><property name="keepAliveSeconds" value="60" /></bean><bean id="multipartResolver"class="org.springframework.web.multipart.commons.CommonsMultipartResolver"><property name="defaultEncoding" value="utf-8" /></bean><!-- 定时 任务 start --><bean id="largessIntegralTask" class="com.task.Task"></bean><bean id="ATaskDetail"class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"><property name="targetObject" ref="largessIntegralTask" /><property name="targetMethod" value="execute" /><property name="concurrent" value="false" /></bean><bean id="ATaskDetailTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"><property name="jobDetail" ref="largessIntegralTaskDetail" /><property name="cronExpression" value="0 0/1 * * * ?" /></bean><!-- 定单处理任务 每分钟执行一次 --><bean id="orderProcessing_Task" class="com.task.Task"></bean><bean id="BTaskDetail"class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"><property name="targetObject" ref="orderProcessing_Task" /><property name="targetMethod" value="execute" /><property name="concurrent" value="false" /></bean><bean id="BTaskDetailTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"><property name="jobDetail" ref="orderProcessing_TaskDetail" /><property name="cronExpression" value="0 0/1 * * * ?" /></bean><!-- 每天00:01:00检查 --><bean id="productSales_Task" class="com.task.Task"></bean><bean id="CTaskDetail"class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"><property name="targetObject" ref="productSales_Task" /><property name="targetMethod" value="execute" /><property name="concurrent" value="false" /></bean><bean id="CTaskDetailTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"><property name="jobDetail" ref="productSales_TaskDetail" /><property name="cronExpression" value="0 1 0 * * ?" /></bean><!-- 静态化页面定时 --><bean id="DTask" class="com.task.Task"></bean><bean id="DTaskDetail"class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"><property name="targetObject" ref="html_Task" /><property name="targetMethod" value="execute" /><property name="concurrent" value="false" /></bean><bean id="DTaskDetailTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"><property name="jobDetail" ref="html_TaskDetail" /><property name="cronExpression" value="0 0/30 * * * ?" /></bean><!-- 定时 任务 end --><bean id="scheduler"class="org.springframework.scheduling.quartz.SchedulerFactoryBean"><property name="triggers"><list><ref bean="BTaskDetailTrigger" /><ref bean="CTaskDetailTrigger" /><ref bean="DTaskDetailTrigger" /></list></property></bean></beans>

0 0
原创粉丝点击