Home >Java >javaTutorial >Examples of integration and calling of spring and quartz
There will be regular tasks at work ~ learn it briefly.
Step 0:
If a worker wants to do his job well, he must first sharpen his tools. The first thing to do is to guide the package.
Configure package scanning in spring and import packages in pom
spring.xml:
pom.xml
1. Configure related attributes in spring-quartz.xml (the same location as spring.xml)
The header of xml may be different for everyone, you have to use this yourself Pay attention when.
#The quartz expression is written according to your own needs. I won’t list it here. The one here is once every second.
2. Configuration class under the Task package
We store the scheduled tasks in a package and name it task. Use spring’s automatic annotation service operation
3. Implement related methods in Service
The real method to operate is to implement it here. It’s up to you what you want to do~Choose a simple output here
4. Start the server, the effect is as shown
The above is the detailed content of Examples of integration and calling of spring and quartz. For more information, please follow other related articles on the PHP Chinese website!