我使用弹簧批和石英调度器每5秒触发一次作业。
<bean name="JobA" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.batch.test.FirstJob" />
</bean>
这里不是传递类本身就可以传递bean的引用吗?
<bean id="firstJob" class="com.batch.test.FirstJob">
<property name="sessionFactory" ref="sessionFactory"> </property>
</bean>
<bean name="JobA" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" ref="firstJob" />
</bean>
这可能吗?
答案 0 :(得分:0)
是。它完全取决于你的用例。
考虑下面的课程:
public ClassA{
private Class clazz;
private FirstJob firstJob;
public Class getClazz() {
return clazz;
}
public void setClazz(Class clazz) {
this.clazz = clazz;
}
public FirstJob getFirstJob() {
return firstJob;
}
public void setFirstJob(FirstJob firstJob) {
this.firstJob = firstJob;
}
}
依赖注入:
<bean id="firstJob" class="com.batch.test.FirstJob">
<property name="sessionFactory" ref="sessionFactory"> </property>
</bean>
<bean name="JobA" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="clazz" value="com.batch.test.FirstJob" />
<property name="firstJob" ref="firstJob" />
</bean>
答案 1 :(得分:0)
最后才知道必须要做什么。
WebDriver driver = new FirefoxDriver(profile);
希望有一天对某人有用:)