读书人

zz spring quartz 配备

发布时间: 2012-06-27 14:20:08 作者: rapoo

zz spring quartz 配置
在网上找spring+quartz的配置文档都是针对spring2.0版本的,用2.5会莫名其妙的出错,2.5版本的配置如下:

applicationContext-scheduler.xml:
Java代码
<!-- 定时任务 -->
<bean id="schedulerFactoryBean" lazy-init="false" autowire="no"
value="classpath:quartz.properties"/>
</bean>

<!-- 定义触发时间 -->
<bean id="doTime" lazy-init="false" autowire="no"
value="classpath:quartz.properties"/>
</bean>

<!-- 定义触发时间 -->
<bean id="doTime" };
// }


public static void main(String [] argo){
System.out.println("Test start.");
ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext-scheduler.xml");
System.out.print("Test end..");

}


}

public class QuartzTest {



//@Override
//protected String[] getConfigLocations() {
//return new String[] { "classpath:/applicationContext.xml", "classpath:/applicationContext-scheduler.xml" };
//}


public static void main(String [] argo){
System.out.println("Test start.");
ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext-scheduler.xml");
System.out.print("Test end..");

}


}

读书人网 >开源软件

热点推荐