修改数据库是pgsql时quartz启动失败问题
Signed-off-by: 王祁 <593401899@qq.com>
This commit is contained in:
parent
30530a6edc
commit
229e8c15b1
|
@ -3,6 +3,8 @@ package net.maku.quartz.config;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import net.maku.framework.common.constant.Constant;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Properties;
|
||||
|
@ -16,6 +18,9 @@ import java.util.Properties;
|
|||
@Configuration
|
||||
public class ScheduleConfig {
|
||||
|
||||
@Value("spring.datasource.driver-class-name")
|
||||
private String driver;
|
||||
|
||||
@Bean
|
||||
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
|
||||
// quartz参数
|
||||
|
@ -38,6 +43,10 @@ public class ScheduleConfig {
|
|||
prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
|
||||
prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
|
||||
|
||||
//postgreSql数据库配置
|
||||
if(Constant.PGSQL_DRIVER.equals(driver)){
|
||||
prop.put("org.quartz.jobStore.driverDelegateClass", "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate");
|
||||
}
|
||||
SchedulerFactoryBean factory = new SchedulerFactoryBean();
|
||||
factory.setSchedulerName("MakuScheduler");
|
||||
factory.setDataSource(dataSource);
|
||||
|
|
|
@ -44,4 +44,9 @@ public interface Constant {
|
|||
*/
|
||||
String OK = "OK";
|
||||
|
||||
/**
|
||||
* pgsql的driver
|
||||
*/
|
||||
String PGSQL_DRIVER = "org.postgresql.Driver";
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user