Commit fa47073d authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '2.0.x'

parents 602f23c3 c6fdb4f0
......@@ -39,6 +39,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.core.io.ResourceLoader;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
......@@ -132,6 +133,7 @@ public class QuartzAutoConfiguration {
protected static class JdbcStoreTypeConfiguration {
@Bean
@Order(0)
public SchedulerFactoryBeanCustomizer dataSourceCustomizer(
QuartzProperties properties, DataSource dataSource,
@QuartzDataSource ObjectProvider<DataSource> quartzDataSource,
......
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -16,12 +16,19 @@
package org.springframework.boot.autoconfigure.quartz;
import javax.sql.DataSource;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
/**
* Callback interface that can be implemented by beans wishing to customize the Quartz
* {@link SchedulerFactoryBean} before it is fully initialized, in particular to tune its
* configuration.
* <p>
* For customization of the {@link DataSource} used by Quartz, use of
* {@link QuartzDataSource @QuartDataSource} is preferred. It will ensure consistent
* customization of both the {@link SchedulerFactoryBean} and the
* {@link QuartzDataSourceInitializer}.
*
* @author Vedran Pavic
* @since 2.0.0
......
......@@ -6253,6 +6253,11 @@ NOTE: By default, the database is detected and initialized by using the standard
provided with the Quartz library. It is also possible to provide a custom script by
setting the `spring.quartz.jdbc.schema` property.
To have Quartz use a `DataSource` other than the application's main `DataSource`, declare
a `DataSource` bean, annotating its `@Bean` method with `@QuartzDataSource`. Doing so
ensures that the Quartz-specific `DataSource` is used by both the `SchedulerFactoryBean`
and for schema initialization.
By default, jobs created by configuration will not overwrite already registered jobs that
have been read from a persistent job store. To enable overwriting existing job definitions
set the `spring.quartz.overwrite-existing-jobs` property.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment