spring mysql多数据源配置
时间:2021-07-01 10:21:17
帮助过:34人阅读
public class QuartzConfig {
@Autowired
private AutowireJobFactory jobFactory;
@Bean(name = "quartzDataSource"
)
@ConfigurationProperties(prefix="
spring.datasource.quartz"
)
public DataSource quartzDataSource() {
return DataSourceBuilder.create().build();
}
private Properties quartzProperties() {
Properties properties =
new Properties();
properties.put("org.quartz.jobStore.tablePrefix", "DC_QRTZ_"
);
return properties;
}
@Bean
public SchedulerFactoryBean schedulerFactoryBean() {
SchedulerFactoryBean schedulerFactoryBean =
new SchedulerFactoryBean();
schedulerFactoryBean.setJobFactory(jobFactory);
schedulerFactoryBean.setDataSource(quartzDataSource());
schedulerFactoryBean.setQuartzProperties(quartzProperties());
return schedulerFactoryBean;
}
@Bean
public Scheduler scheduler() {
return schedulerFactoryBean().getScheduler();
}
}
application.properties
# quartz datasource
spring.datasource.quartz.url=jdbc:mysql://rds.aliyuncs.com:3306/iotx-data-center-meta
spring.datasource.quartz.username=dataservice
spring.datasource.quartz.password=Data12345
spring.datasource.quartz.driver-class-name=com.mysql.jdbc.Driver
spring mysql多数据源配置
标签:source pre 多数据源 ica word uart tab pos color