zoukankan      html  css  js  c++  java
  • spring mysql多数据源配置

    spring mysql多数据源配置

    @Configuration
    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
  • 相关阅读:
    Apriori算法原理总结
    FP Tree算法原理总结
    用Spark学习FP Tree算法和PrefixSpan算法
    《万历十五年》段落摘抄
    DPDK mempool
    DPDK PCIe 与 包处理
    《汇编语言》-- 控制执行流程
    《黑客攻防技术-系统实战》第二章--栈溢出4
    DPDK报文转发
    DPDK同步互斥机制
  • 原文地址:https://www.cnblogs.com/diegodu/p/8143790.html
Copyright © 2011-2022 走看看