<?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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
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/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
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
<!--使Spring支持自動檢測組件,如注解的@Controller -->
<context:component-scan base-package="com.parry.test.*" />
<bean
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" />
<bean
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<!-- 數(shù)據(jù)庫配置 -->
<bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<!-- 測試數(shù)據(jù)庫 -->
<property name="jdbcUrl"
value="jdbc:mysql://127.0.0.1:3066/TESTDB?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true" />
<property name="username" value="root" />
<property name="password" value="root" />
<!-- 檢查數(shù)據(jù)庫連接池中空閑連接的間隔時間,單位是分,默認值:240,如果要取消則設(shè)置為0 -->
<property name="idleConnectionTestPeriod" value="240" />
<!-- 連接池中未使用的鏈接最大存活時間,單位是分,默認值:30,如果要永遠存活設(shè)置為0 -->
<!-- 數(shù)據(jù)庫連接池過期時間應(yīng)小于等于mysql的過期時間和mycat的過期時間 -->
<property name="idleMaxAge" value="20" />
<!-- 每個分區(qū)最大的連接數(shù) -->
<property name="maxConnectionsPerPartition" value="100" />
<!-- 每個分區(qū)最小的連接數(shù) -->
<property name="minConnectionsPerPartition" value="20" />
<!-- 分區(qū)數(shù) ,默認值2,最小1,推薦3-4,視應(yīng)用而定 -->
<property name="partitionCount" value="1" />
<!-- 每次去拿數(shù)據(jù)庫連接的時候一次性要拿幾個,默認值:2 -->
<property name="acquireIncrement" value="2" />
<!-- 緩存prepared statements的大小,默認值:0 -->
<property name="statementsCacheSize" value="0" />
<property name="connectionTimeoutInMs" value="100" />
<!-- 每個分區(qū)釋放鏈接助理進程的數(shù)量,默認值:3,除非你的一個數(shù)據(jù)庫連接的時間內(nèi)做了很多工作,不然過多的助理進程會影響你的性能 -->
<property name="releaseHelperThreads" value="3" />
</bean>
<!-- 配置SqlSessionFactoryBean -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:mybatis.xml" />
<!-- mapper和resultmap配置路徑 -->
<property name="mapperLocations">
<list>
<!-- 表示在com.sfpay.mapper包或以下所有目錄中,以-resultmap.xml結(jié)尾所有文件 -->
<value>classpath:com/parry/test/dao/config/*.xml</value>
</list>
</property>
</bean>
<!-- 配置mapper接口 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.cn21.calendar.dao" />
</bean>
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactory" />
</bean>
<!-- 事務(wù)配置 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 用于持有ApplicationContext,可以使用SpringContextHolder.getBean('xxxx')的靜態(tài)方法得到spring
bean對象 -->
<bean class="com.parry.test.springcontext.SpringContextHolder"
lazy-init="false" />
<!-- 定時器 begin -->
<!-- 賽程 調(diào)度業(yè)務(wù)對象 -->
<bean id="deletePastOrderJob" class="com.parry.test.function.PublicTypeFunction" />
<!-- 賽程 調(diào)度業(yè)務(wù) -->
<bean id="deletePastOrderTask"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="deletePastOrderJob" />
<property name="targetMethod" value="deletePastOrder" />
</bean>
<!-- 賽程 調(diào)度器觸發(fā)器 每天早上07:00執(zhí)行一次 -->
<bean id="deletePastOrderTaskTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="deletePastOrderTask" />
<property name="cronExpression" value="0 13 09 * * ? *" />
</bean>
<!-- 設(shè)置調(diào)度 -->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<!-- <ref bean="deletePastOrderTaskTrigger" /> -->
</list>
</property>
</bean>
<!-- 定時器 end -->
<!-- 服務(wù)器啟動,初始化項目配置參數(shù) -->
<bean name="InitalizeBean" class="com.parry.test.configure.impl.InitalizeBean" />
</beans>
springMVC之a(chǎn)pplicationcontext.xml配置說明
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 從嘗試著在ssm項目中配置swagger的過程中,瘋狂百度、谷歌,仍然配置的有問題,好尷尬。 趁著熱乎著,趕緊把配...
- eclipse4.7.0 + jdk8 + tomcat9 + spring4.2.0 + mybatis Mav...
- 配置springmvc 1:開啟springmvc注解模式 <mvc:annotation-driven /> 這...
- 一、為什么要整合SpringMVC和MyBatis 1、使用Spring來管理所有的組件,使用Spring的依賴注...
- 配置攔截器,比如攔截登陸狀態(tài)的這類攔截器。攔截特定的url 1.首先是攔截器代碼 2.自定義的注解 3.配置攔截器...