下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年深圳职业技术大学单招职业适应性测试题库及答案详解1套
- 2026年河北省沧州市单招职业适应性测试题库及参考答案详解一套
- 2026年邯郸科技职业学院单招职业技能考试题库及答案详解1套
- 2026年内蒙古美术职业学院单招职业技能考试题库带答案详解
- 安徽铁路面试题目及答案
- 护士职称面试题库及答案
- 标点符号练习题附答案
- 2025年西藏气象部门公开招聘应届高校毕业生9人备考题库(第二批)及参考答案详解
- 2025年澄江市教育体育系统公开招聘毕业生备考题库及1套参考答案详解
- 2025年眉山市青神县总医院县中医医院分院招聘备考题库及参考答案详解
- 食堂营销方案总结(3篇)
- 2025烟花炮竹考试题目及答案
- 钻孔灌注桩深基坑支护施工方案
- 劳务派遣公司管理制度(3篇)
- 贵州省金沙县沙土镇汇鑫煤矿市场化矿山生态修复整改技术方案
- 高标准农田安全生产管理制度
- GB/T 17038-2025内燃机车柴油机油
- 中西医结合儿科学练习试卷3(共872题) (一)
- 2025四川宜宾三江投资建设集团有限公司下属子公司第二批员工招聘21人笔试历年典型考点题库附带答案详解2套试卷
- GB/T 16293-2025医药工业洁净室(区)浮游菌的测试方法
- 职业教育与阶层跃迁-洞察与解读
评论
0/150
提交评论