logback-spring.xml 中cron具体配置给出完整代码
时间: 2023-03-07 08:37:14 浏览: 37
Logback-spring.xml中cron具体配置的代码如下:<task:scheduled-tasks>
<task:scheduled ref="taskBean" method="executeTask" cron="0 0/5 * * * ?" />
</task:scheduled-tasks>
相关问题
logback-spring.xml cron定时器配置给出完整代码
<task:scheduled-tasks scheduler="myScheduler">
<task:scheduled ref="runTask" method="run" cron="0 0/1 * * * ?" />
</task:scheduled-tasks>上面的代码可以用来配置 logback-spring.xml 中的 cron 定时器,每分钟执行一次 runTask 中的 run 方法。
logback-spring.xml 中cron具体配置给出完整logback-spring.xml 代码
<?xml version="1.0" encoding="UTF-8"?>
<configuration> <include resource="org/springframework/scheduling/quartz/quartz-context.xml" /> <springProfile name="quartz">
<bean id="logbackJob" class="ch.qos.logback.core.db.JobWithHistory">
<property name="dynamicSql" value="INSERT INTO LoggingEvent (timestmp, formatted_message, logger_name, level_string, thread_name, reference_flag, caller_filename, caller_class, caller_method, caller_line, event_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" />
</bean> <bean id="logbackTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="logbackJob" />
<property name="cronExpression" value="0 0 0 * * ?" />
</bean>
</springProfile></configuration>
相关推荐









