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 ...@@ -39,6 +39,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
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.core.annotation.Order;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import org.springframework.scheduling.quartz.SchedulerFactoryBean; import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
...@@ -132,6 +133,7 @@ public class QuartzAutoConfiguration { ...@@ -132,6 +133,7 @@ public class QuartzAutoConfiguration {
protected static class JdbcStoreTypeConfiguration { protected static class JdbcStoreTypeConfiguration {
@Bean @Bean
@Order(0)
public SchedulerFactoryBeanCustomizer dataSourceCustomizer( public SchedulerFactoryBeanCustomizer dataSourceCustomizer(
QuartzProperties properties, DataSource dataSource, QuartzProperties properties, DataSource dataSource,
@QuartzDataSource ObjectProvider<DataSource> quartzDataSource, @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -16,12 +16,19 @@ ...@@ -16,12 +16,19 @@
package org.springframework.boot.autoconfigure.quartz; package org.springframework.boot.autoconfigure.quartz;
import javax.sql.DataSource;
import org.springframework.scheduling.quartz.SchedulerFactoryBean; import org.springframework.scheduling.quartz.SchedulerFactoryBean;
/** /**
* Callback interface that can be implemented by beans wishing to customize the Quartz * 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 * {@link SchedulerFactoryBean} before it is fully initialized, in particular to tune its
* configuration. * 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 * @author Vedran Pavic
* @since 2.0.0 * @since 2.0.0
......
...@@ -6253,6 +6253,11 @@ NOTE: By default, the database is detected and initialized by using the standard ...@@ -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 provided with the Quartz library. It is also possible to provide a custom script by
setting the `spring.quartz.jdbc.schema` property. 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 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 have been read from a persistent job store. To enable overwriting existing job definitions
set the `spring.quartz.overwrite-existing-jobs` property. 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