When using dynamic port allocation, a circular dependency may exist if the application needs to know what port it's
running on, since the port won't be know until after the server has bound to the listening port (the OS will select
a free port at bind time), but we can't bind the server to the listening port until we have an application to
service incoming requests.
This trait allows that circular dependency to be resolved, by making the port available as a future, and allowing it
to be provided after the application has been created using the
RequiresLagomServicePort.provideLagomServicePort() method.
This is primarily useful for testing, where dynamic port allocation is often used.
When using dynamic port allocation, a circular dependency may exist if the application needs to know what port it's running on, since the port won't be know until after the server has bound to the listening port (the OS will select a free port at bind time), but we can't bind the server to the listening port until we have an application to service incoming requests.
This trait allows that circular dependency to be resolved, by making the port available as a future, and allowing it to be provided after the application has been created using the RequiresLagomServicePort.provideLagomServicePort() method.
This is primarily useful for testing, where dynamic port allocation is often used.