现在的需求是,更新主账号下面的从账号密码,定时任务我已经配好了,服务器一启动就自动执行,但是我修改的时候是需要修改已配置好的账号,然后默认是没配置账号,这种应该怎么实现
启动的时候查看是否配置了,如果查询到了就修改,没有就不修改。
你好,怎么能配置某个账号已经配置了定时任务呢???
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<!-- 从账号定时任务的bean(杨航) -->
<bean id="subAccountBean" class="com.fultrust.pmc.tool.job.SubAccount" />
<!-- 定时器(杨航) -->
<bean id="subAccountJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="subAccountBean"></property>
<property name="targetMethod" value="execute"></property>
<property name="concurrent" value="true"></property>
</bean>
<!-- 触发器(杨航) -->
<bean id="quartzTestTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="subAccountJob" />
<!--TEST 每五秒执行一次 -->
<!-- <property name="cronExpression" value="0/5 * * * * ?"></property> -->
<!-- 每月1号凌晨1点执行一次:0 0 1 1 * ? -->
<property name="cronExpression" value="0 0 1 1 * ?"></property>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<!-- 触发器的ID注入到启动器(杨航) -->
<ref bean="quartzTestTrigger" />
</list>
</property>
</bean>
这是我配置的,启动以后就自动调用我的那个类了。
public class DataUtil {
public static final List<String> list=new ArrayList<String>();
static{
list.add("你的帐号")
}
}
DataUtil.list.contains("你的帐号");