I found some information about spring scheduled execution tasks on the Internet, and found that all the information is detailed, but the jar package to be introduced is missing.
In this case, if the jar package in the project is not full, the configuration file will report an error, which will be quite troublesome for some new users (such as me.
The configuration of the scheduled service is as follows:
Add the following code to the spring configuration file.
<! -- Start customization service --> <br/> <bean id = "methodinvokingjobdetail" <br/> class = "org. springframework. scheduling. quartz. methodinvokingjobdetailfactorybean "> <br/> <property name =" targetobject "> <br/> <! -- Your own service to be associated --> <br/> <ref bean = "cardinfomanager"/> <br/> </property> <br/> <property name = "targetmethod "> <br/> <! -- The method outputlocaltime in the associated service is the name of the method to be executed --> <br/> <value> outputlocaltime </value> <br/> </property> <br/> </bean> </P> <p> <! -- Define the trigger time --> <br/> <bean id = "cront" class = "org. springframework. scheduling. quartz. crontriggerbean "> <br/> <property name =" jobdetail "> <br/> <ref bean =" methodinvokingjobdetail "/> <br/> </property> <br/> <! -- The value below is the set trigger time --> <br/> <property name = "cronexpression"> <br/> <value> 0/10 0 **? </Value> <br/> </property> <br/> </bean> </P> <p> <! -- Total management --> <br/> <Bean class = "org. springframework. scheduling. quartz. schedulerfactorybean "> <br/> <property name =" triggers "> <br/> <list> <ref local =" cront "/> </List> <br/> </property> <br/> </bean> <br/> <! -- End of Custom Service -->
Note that at this time the system needs to introduce the quartz-all-1.6.1.jar jar package or the spring configuration file will be out:
"No setter found for property 'cronexpression 'in class..." error.
At the same time to put the "commons-collections-3.2.jar" into the lower version or don't put it may have the following error:
"
Java. Lang. nosuchmethoderror: org. Apache. commons. Collections. setutils. orderedset (ljava/util/set;) ljava/util/set;
"
You just need to put the jar above under the Lib of the project.