In Boot 3.5.8, @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) would start a server and configure a TestRestTemplate from which you could get the URI to that server to e.g. test some non-Spring client code.
In Boot 4.0.0, adding @AutoConfigureTestRestTemplate to the same configures a TestRestTemplate, but getRootUri() always returns "". This isn't mentioned in the migration guide.
Should that be considered a bug, and/or is there another intended way to get the URI (in particular the port) for the test server?
In Boot 3.5.8,
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)would start a server and configure aTestRestTemplatefrom which you could get the URI to that server to e.g. test some non-Spring client code.In Boot 4.0.0, adding
@AutoConfigureTestRestTemplateto the same configures aTestRestTemplate, butgetRootUri()always returns"". This isn't mentioned in the migration guide.Should that be considered a bug, and/or is there another intended way to get the URI (in particular the port) for the test server?