!11 修复数据库是pgsql时添加quartz模块启动失败报long类型问题
Merge pull request !11 from 王祁/master
This commit is contained in:
commit
2f034547e4
|
@ -3,6 +3,8 @@ package net.maku.quartz.config;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
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 javax.sql.DataSource;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -16,6 +18,9 @@ import java.util.Properties;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ScheduleConfig {
|
public class ScheduleConfig {
|
||||||
|
|
||||||
|
@Value("spring.datasource.driver-class-name")
|
||||||
|
private String driver;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
|
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
|
||||||
// quartz参数
|
// quartz参数
|
||||||
|
@ -38,6 +43,10 @@ public class ScheduleConfig {
|
||||||
prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
|
prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
|
||||||
prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
|
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();
|
SchedulerFactoryBean factory = new SchedulerFactoryBean();
|
||||||
factory.setSchedulerName("MakuScheduler");
|
factory.setSchedulerName("MakuScheduler");
|
||||||
factory.setDataSource(dataSource);
|
factory.setDataSource(dataSource);
|
||||||
|
|
|
@ -44,4 +44,9 @@ public interface Constant {
|
||||||
*/
|
*/
|
||||||
String OK = "OK";
|
String OK = "OK";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pgsql的driver
|
||||||
|
*/
|
||||||
|
String PGSQL_DRIVER = "org.postgresql.Driver";
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user