- 加入NTP Server
- nano /etc/ntp.conf
- 加入 # server [IP]
- 測試連線
- ntpdate [IP]
- ntpq -p
- 啟動對時
- systemctl start ntpd
- 開啟對時
- systemctl enable ntpd
2019/1/31
NTP 對時指令
2019/1/20
Spring中建立Quartz @Autowired
- 建立MyJobFactory Class
- public class MyJobFactory extends AdaptableJobFactory{
- //这个对象Spring会帮我们自动注入进来,也属于Spring技术范畴.
- @Autowired
- private AutowireCapableBeanFactory capableBeanFactory;
- protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
- //调用父类的方法
- Object jobInstance = super.createJobInstance(bundle);
- //进行注入,这属于Spring的技术,不清楚的可以查看Spring的API.
- capableBeanFactory.autowireBean(jobInstance);
- return jobInstance;
- }
- }
2. 加入
<bean id="jobFactory" class="dim.job.MyJobFactory"></bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<bean id="jobFactory" class="dim.job.MyJobFactory"></bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="jobFactory" ref="jobFactory"></property>
</bean>
Spring中建立Quartz集群
參考網址
- 建maven pom.xml
- spring + quartz
- 下載 quart 包
- 執行 DDL
- 增加spring-quartz.properties文件
- 每一項bean , org.springframework.scheduling.quartz.JobDetailFactoryBean
- 加上<property name="durability" value="true"></property>
- bean org.springframework.scheduling.quartz.SchedulerFactoryBean
- 加上<property name="dataSource" ref="dataSource"></property>
<property name="overwriteExistingJobs" value="true" />
<property name="startupDelay" value="30" />
<property name="autoStartup" value="true" />
<property name="applicationContextSchedulerContextKey" value="applicationContextKey" />
<property name="configLocation" value="classpath:spring-quartz.properties" />
訂閱:
文章 (Atom)