Skip to content

TestRestTemplate.getRootUri() returns empty string #48330

@OrangeDog

Description

@OrangeDog

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?

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions