A report computing server is used in the project. When the project runs, the related computing methods are started.
I thought about it. spring is a java web project and it manages everything. Check whether the scheduled scheduling function is available.
Spring provides two triggers: CronTriggerBean and SimpleTriggerBean.
So lazy. Let's make a short speech.
Environment: spring + ibatis. First configure the spring configuration file. Write the service layer (the specific calculation method is written here ).
1. CronTriggerBean
[Html]
<! -- Define job -->
<Bean name = "mathsJob1"
Class = "org. springframework. scheduling. quartz. MethodInvokingJobDetailFactoryBean">
<! -- Injected service layer -->
<Property name = "targetObject" ref = "mathsService"/>
<! -- Call Method --> www.2cto.com
<Property name = "targetMethod" value = "aotoMathsMethod1"/>
<! -- If concurrent is true, a QuartzJob can be executed concurrently. Otherwise, the job is executed sequentially. -->
<Property name = "concurrent" value = "false"/>
</Bean>
<! -- Define the CronTriggerBean trigger -->
<Bean id = "mathsTriggerBean" class = "org. springframework. scheduling. quartz. CronTriggerBean">
<! -- Inject the job to be started -->
<Property name = "jobDetail">
<Ref bean = "mathsJob1"/>
</Property>
<! -- Trigger rule, which is triggered at every day -->
<Property name = "cronExpression">
<Value> 0 0 1 **? </Value>
</Property>
</Bean>
<! -- Define job -->
<Bean name = "mathsJob1"
Class = "org. springframework. scheduling. quartz. MethodInvokingJobDetailFactoryBean">
<! -- Injected service layer -->
<Property name = "targetObject" ref = "mathsService"/>
<! -- Call Method -->
<Property name = "targetMethod" value = "aotoMathsMethod1"/>
<! -- If concurrent is true, a QuartzJob can be executed concurrently. Otherwise, the job is executed sequentially. -->
<Property name = "concurrent" value = "false"/>
</Bean>
<! -- Define the CronTriggerBean trigger -->
<Bean id = "mathsTriggerBean" class = "org. springframework. scheduling. quartz. CronTriggerBean">
<! -- Inject the job to be started -->
<Property name = "jobDetail">
<Ref bean = "mathsJob1"/>
</Property>
<! -- Trigger rule, which is triggered at every day -->
<Property name = "cronExpression">
<Value> 0 0 1 **? </Value>
</Property>
</Bean>
2. SimpleTriggerBean
[Html]
<! -- Define job -->
<Bean name = "mathsJob2"
Class = "org. springframework. scheduling. quartz. MethodInvokingJobDetailFactoryBean">
<! -- Injected service layer -->
<Property name = "targetObject" ref = "mathsService"/>
<! -- Call Method -->
<Property name = "targetMethod" value = "aotoMathsMethod2"/>
<! -- If concurrent is true, a QuartzJob can be executed concurrently. Otherwise, the job is executed sequentially. -->
<Property name = "concurrent" value = "false"/>
</Bean>
<! -- Define SimpleTriggerBean trigger -->
<Bean id = "mathsTriggerBean" class = "org. springframework. scheduling. quartz. SimpleTriggerBean">
<! -- Inject the job to be started -->
<Property name = "jobDetail">
<Ref bean = "mathsJob2"/>
</Property>
<! -- Start after 30 s -->
<Property name = "startDelay" value = "30000"/>
<! -- 10 s check -->
<Property name = "repeatInterval" value = "2*60*60*1000"/>
</Bean>
<! -- Define job -->
<Bean name = "mathsJob2"
Class = "org. springframework. scheduling. quartz. MethodInvokingJobDetailFactoryBean">
<! -- Injected service layer -->
<Property name = "targetObject" ref = "mathsService"/>
<! -- Call Method -->
<Property name = "targetMethod" value = "aotoMathsMethod2"/>
<! -- If concurrent is true, a QuartzJob can be executed concurrently. Otherwise, the job is executed sequentially. -->
<Property name = "concurrent" value = "false"/>
</Bean>
<! -- Define SimpleTriggerBean trigger -->
<Bean id = "mathsTriggerBean" class = "org. springframework. scheduling. quartz. SimpleTriggerBean">
<! -- Inject the job to be started -->
<Property name = "jobDetail">
<Ref bean = "mathsJob2"/>
</Property>
<! -- Start after 30 s -->
<Property name = "startDelay" value = "30000"/>
<! -- 10 s check -->
<Property name = "repeatInterval" value = "2*60*60*1000"/>
</Bean>