org.springframework.boot.autoconfigure.quartz.QuartzDataSource Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.quartz.QuartzDataSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApiBootQuartzAutoConfiguration.java    From beihu-boot with Apache License 2.0 5 votes vote down vote up
@Bean
@Order(1)
public SchedulerFactoryBeanCustomizer jobDataSourceCustomizer(ApiBootQuartzProperties properties, DataSource dataSource, @QuartzDataSource ObjectProvider<DataSource> quartzDataSource, ObjectProvider<PlatformTransactionManager> transactionManager) {
    return (schedulerFactoryBean) -> {
        if (properties.getJobStoreType() == JobStoreType.JDBC) {
            DataSource dataSourceToUse = this.getDataSource(dataSource, quartzDataSource);
            schedulerFactoryBean.setDataSource(dataSourceToUse);
            PlatformTransactionManager txManager = transactionManager.getIfUnique();
            if (txManager != null) {
                schedulerFactoryBean.setTransactionManager(txManager);
            }
        }

    };
}
 
Example #2
Source File: ApiBootQuartzAutoConfiguration.java    From api-boot with Apache License 2.0 5 votes vote down vote up
@Bean
@Order(1)
public SchedulerFactoryBeanCustomizer jobDataSourceCustomizer(ApiBootQuartzProperties properties, DataSource dataSource, @QuartzDataSource ObjectProvider<DataSource> quartzDataSource, ObjectProvider<PlatformTransactionManager> transactionManager) {
    return (schedulerFactoryBean) -> {
        if (properties.getJobStoreType() == JobStoreType.JDBC) {
            DataSource dataSourceToUse = this.getDataSource(dataSource, quartzDataSource);
            schedulerFactoryBean.setDataSource(dataSourceToUse);
            PlatformTransactionManager txManager = transactionManager.getIfUnique();
            if (txManager != null) {
                schedulerFactoryBean.setTransactionManager(txManager);
            }
        }

    };
}
 
Example #3
Source File: SpringQrtzScheduler.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
@QuartzDataSource
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource quartzDataSource() {
    return DataSourceBuilder.create().build();
}
 
Example #4
Source File: ApiBootQuartzAutoConfiguration.java    From beihu-boot with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public ApiBootQuartzDataSourceInitializer apiBootQuartzDataSourceInitializer(DataSource dataSource, @QuartzDataSource ObjectProvider<DataSource> quartzDataSource, ResourceLoader resourceLoader, ApiBootQuartzProperties properties) {
    DataSource dataSourceToUse = this.getDataSource(dataSource, quartzDataSource);
    return new ApiBootQuartzDataSourceInitializer(dataSourceToUse, resourceLoader, properties);
}
 
Example #5
Source File: ApiBootQuartzAutoConfiguration.java    From api-boot with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public ApiBootQuartzDataSourceInitializer apiBootQuartzDataSourceInitializer(DataSource dataSource, @QuartzDataSource ObjectProvider<DataSource> quartzDataSource, ResourceLoader resourceLoader, ApiBootQuartzProperties properties) {
    DataSource dataSourceToUse = this.getDataSource(dataSource, quartzDataSource);
    return new ApiBootQuartzDataSourceInitializer(dataSourceToUse, resourceLoader, properties);
}