This module provides a Time supplier that can be reused and composed in other applications.
The Supplier
uses the FastDateFormat
from Apache Commons library.
timeSupplier
is implemented as a java.util.function.Supplier
.
The TimeSupplierConfiguration
auto-configuration provides the following bean:
timeSupplier
You need to inject this as Supplier<String>
.
You can use timeSupplier
as a qualifier when injecting.
Once injected, you can use the get
method of the Supplier
to invoke it.
All configuration properties are prefixed with time
.
For more information on the various options available, please see TimeSupplierProperties.
See this test suite for the various ways, this supplier is used.
See this README where this supplier is used to create a Spring Cloud Stream application where it makes an Time Source.