Hi Team,

I have a use case where I need to test my application with future dates.

Is there a Spring property that allows me to set the current time so that I can test with future or past dates? I need a simple solution that doesn't require extensive changes. Specifically, I want calls to Instant.now() to return a manipulated current instant, such as the server time being 4 days ahead, so that all calls to now() reflect this adjusted time.

I found some information online, but it’s either not relevant or requires too many changes.

Please let me know if there is a straightforward way to achieve this.

Thanks, Nitin

Comment From: wilkinsona

Duplicates https://github.com/spring-projects/spring-boot/issues/31397.