Skip to content

Commit

Permalink
fix: Respect always-persist-timestamp-in-utc in Spring Starter (#487) (
Browse files Browse the repository at this point in the history
…#490)

## Brief, plain english overview of your changes here
I've changed the Spring Boot auto-configuration to ensure that the
`jdbcCustomization` default does not override the configured
`alwaysPersistTimestampInUTC` default. The previous `orElse` part is not
necessary because the correct `jdbcCustomization` default later gets
applied in `SchedulerBuilder#build`.

## Fixes
Fixes #487 


## Reminders
- [ ] Added/ran automated tests
  - I don't know how to add an efficient test for this.
- I ran the tests but I got an unrelated error in an Oracle
compatibility test, even without this change.
- [ ] Update README and/or examples
  - I don't think this is relevant.
- [ ] Ran `mvn spotless:apply`
  - This only changed unrelated code.

---
Co-authored-by: Georg Echterling <g.echterling@jobware.de>
  • Loading branch information
GeorgEchterling committed May 28, 2024
1 parent de44763 commit b0e981b
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.github.kagkarlsson.scheduler.boot.config.startup.ContextReadyStart;
import com.github.kagkarlsson.scheduler.boot.config.startup.ImmediateStart;
import com.github.kagkarlsson.scheduler.exceptions.SerializationException;
import com.github.kagkarlsson.scheduler.jdbc.AutodetectJdbcCustomization;
import com.github.kagkarlsson.scheduler.serializer.Serializer;
import com.github.kagkarlsson.scheduler.stats.StatsRegistry;
import com.github.kagkarlsson.scheduler.task.OnStartup;
Expand Down Expand Up @@ -146,10 +145,7 @@ public Scheduler scheduler(DbSchedulerCustomizer customizer, StatsRegistry regis
builder.serializer(customizer.serializer().orElse(SPRING_JAVA_SERIALIZER));

// Use custom JdbcCustomizer if provided.
builder.jdbcCustomization(
customizer
.jdbcCustomization()
.orElse(new AutodetectJdbcCustomization(transactionalDataSource)));
customizer.jdbcCustomization().ifPresent(builder::jdbcCustomization);

if (config.isAlwaysPersistTimestampInUtc()) {
builder.alwaysPersistTimestampInUTC();
Expand Down

0 comments on commit b0e981b

Please sign in to comment.