Skip to content

Expose Clock from builder and implement in Spring Boot AutoConfiguration #720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

deximat
Copy link

@deximat deximat commented Jul 15, 2025

Brief, plain english overview of your changes here

  • Added clock(Clock) method to SchedulerBuilder so users can provide their own clock for Scheduler
  • In order not to have to think about Waiter caching old Clock I moved Waiter creation to build method, so it always uses latest Clock from builder field
  • Had to build Waiter manually in TestHelper for ManualScheduler.

Note: This changes current behavior, but I think it's a bug.
Currently Waiter in ManualScheduler is using SystemClock instead of newly set clock, I changed that because Waiter is now created in the end so it will always use up-to date Clock instance, in case this is desired behavior for some reason, let me know and I will fix it.

Reminders

  • Added/ran automated tests
  • Update README and/or examples
  • Ran mvn spotless:apply

cc @kagkarlsson

@deximat
Copy link
Author

deximat commented Jul 15, 2025

Now user can just define Clock bean and it will automatically be used by AutoConfiguration.

@kagkarlsson
Copy link
Owner

Thank you for contributing!

What was the use-case here? Override clock used in tests that uses Spring to instantiate the Scheduler?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants