下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、spring定时器的动态设置spring还是以整合已有的框架为主,它对时光的设置比较灵便。在spring中,可以继承quartzjobbean,也可以不做任何继承,固然写法也不一样,这里用的非继承的写法。定时器的注册过程:1.创建bean,2.声明bean为一个定时器,3.设置任务时光,4.在调度中注册定时器= ?xml version="1.0" eoding="utf-8"? beans xms="/schema/beans" xmlns:xsi="http:/w
2、/2001/xmlschema-instance" xmlns:aop="/schema/aop" xmlns:tx="/schema/tx" xsi:schemaloion=" /schema/beans /schema/beans/spring-beans-2.0.xsd http:/
3、/schema/tx /schema/tx/spring-tx-2.0.xsd /schema/tx /schema/aop /schema/aop /schema/aop/spring-aop-2.0.xsd" bean ="mysessio
4、nfactory" class="org.springframework.o.hibernate3.localsessionfactorybean" property name="configlocation" value="classpath:hibernate.cfg.xml"/ /bean bean id="mytxmanager" property name="sessionfactory" ref="mysessionfactory"/ /bean tx:
5、advice id="txadvice" ansaction-manager="mytxmanager" tx:attributes tx:method name="*" propagation="required" read-only="true"/ tx:method name="get*" propagation="required" read-only="true"/ tx:method name="save*&quo
6、t; propagation="required" read-only="fae" rollback-for="com.hsexception"/ tx:method name="audit*" propagation="required" read-only="false" rollback-for="com.hsexception"/ tx:method name="do*" propagation="required&q
7、uot; read-only="false" rollback-for="com.hsexception"/ tx:method name="a*" propagation="required" read-only="false" rollback-for="com.hsexception"/ tx:method name="modify*" propagation="required" read-only="false&qu
8、ot; rollback-for="com.hsexception"/ tx:method name="delete*" propagation="required" read-only="false" rollback-for="com.hsexception"/ tx:method name="create*" propagation="required" read-only="false" rollback-for="c
9、om.hsexception"/ tx:method name="up*" propagation="required" read-only="false" rollback-for="com.hsexception"/ tx:method name="*" propagation="supports" read-only="true"/ /tx:attributes /tx:advice aop:config aop:point id=&quo
10、t;systemservicemethods" pression="execution(* com.*.*(.)"/ aop:advisor advice-ref="txadvice" pointcut-ref="systemservicemethods"/ /aop:config bean id="testjob" class="org.springframework.scheling.quartz.jobdetailbean" property name="jobclas
11、s" value="web.testjob"/ property name="jobdataasmap" map entry key="configservice" ref bean="ftpconfigservice"/ /entry /map /property /bean bean id="testjob1" class="org.springframework.schuling.quartz.jobdetailbean" property name=&quo
12、t;jobclass" value="web.test1job"/ property name="jobdataasmap" map entry key="ftpconfigservice" ref bean="ftpconfigservice"/ /entry /map /property /bean bean id="testtrigger" property name="jobdetail" ref="testjob"/ property
13、name="cronexpression" value="0 19 8,9,19,20 * * ?"/ /bean bean id="testtrigger1" property name="jobdetail" ref="testjob"/ property name="cronexpression" value="0 18 8,9,19,20 * * ?"/ /bean bean id="testtrigger2" property
14、 name="jobdetail" ref="testjob1"/ property name="cronexpression" value="0 17 8,9,19,20 * * ?"/ /bean !- bean id="testtrigger" property name="jobdetail" ref="testjob"/ property name="startdelay" value="6000"/ pr
15、operty name="repeatinterval" value="3000"/ /bean - bean id="facbean" property name="triggers" list ref bean="testtrigger"/ ref bean="testtrigger1"/ ref bean="testtrigger2"/ /list /property /bean bean id="ftpconfigdao" sc
16、ope="prototype" property name="sessionfactory" ref local="mysessionfactory" / /property /bean bean id="ftpconfigservice" scope="prototype" property name="ftpconfigdao" ref local="ftpconfigdao"/ /property /bean beans =public class
17、testjob extends quartzjobbean private iftpconfigservice ftpconfigservice; public iftpconfigservice getftpconfigservice() return ftpconfigservice; public void ftpconfigservice(iftpconfigservice ftpconfigservice) this.ftpconfigservice = ftpconfigservice; override protected void executeinternal(jobexec
18、utioncontext arg0) throws jobexecutionexception system.out.println("执行="); try ftpconfig ftp = this.getftpconfigservice().findftpconfigbyid("2"); system.out.println(ftp.getftpurl(); catch(exception e) =public class testservlet extends httpservlet override protected void doget(htt
19、pservletrequest request, httpservletresponse response) throws servletexception, ioexception response.setcontenttype("text/html;charset=utf-8"); string = request.getparameter("time"); webapplicationcontext ctx = webapplicationcontextutils.getwebapplicationcontext(request.getsession().getservletcontext(); iftpconfigservice ftpimp = (iftpconfigservice)ctx.getbean("ftpconfigservice"); try ftpconfig ftp = ftpimp.findftpconfigbyid("8acb968d31fab0230131fab0afcf0001"); system.
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 冠心病心律失常型护理查房
- 消毒剂原料禁限用清单核查
- 物流行业信息共享制度
- 教育资源共享分配制度
- 制造业供应链安全与质量制度
- 安徽合肥市第四十二中学2025-2026学年八年级下学期物理阶段学情自测(含答案)
- 湘潭八年级地理湘中地貌专项训练卷
- 护理疑难病例的预防与控制
- 第四课 思维大挑战教学设计小学心理健康川教版四年级下册-川教版
- 幼小衔接10以内的连加连减教案
- 南平市2025年南平仲裁委员会秘书处招聘工作人员2人笔试历年参考题库典型考点附带答案详解
- 2026年及未来5年市场数据中国玻璃酸钠注射液行业市场竞争格局及投资前景展望报告
- 2026广岩国际投资有限责任公司招聘14人建设笔试模拟试题及答案解析
- 【历史】 明清时期社会经济的发展 课件 2025-2026学年统编版七年级历史下册
- 开滦集团荆个庄矿240万吨新井设计设计说明书
- 财务报表审计工作底稿编制案例
- 卵巢肿瘤教案
- 《肠造口并发症的分型与分级标准(2023版)》解读
- (完整版)内河船舶一类船员适任考试《避碰与信号》试题和答案
- 林木种质资源调查表(新表)
- 正畸治疗的生物机械原理-矫治力与牙齿的移动(口腔正畸学课件)
评论
0/150
提交评论