1、编写需要初始化的类及其方法
package com.boonya.data.init;
public class MemcachedCarInit{
public void init(){
//初始化数据
}
}
2、配置spring启动类方法
applicationContext.xml配置,添加形类下之配置:
<bean id="MemcachedCarInit" class="com.boonya.data.init.MemcachedCarInit"
init-method="init" />
<bean id="MemcachedCarInitDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<bean class="com.boonya.data.init.MemcachedCarInit"></bean>
</property>
<property name="targetMethod">
<value>init</value>
</property>
</bean>