-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate SocketUtils #28052
Comments
This is a user-facing change that should be visible in the changelog so I've switched the issue type to enhancement. |
FYI: |
I know that a PR to remove As an alternative, would moving this to Spring Test be sensible? |
Hi @chrylis, Thanks for the feedback.
We are considering introducing an alternative (with reduced scope) for testing scenarios only in We will continue to deliberate this and listen to community feedback. |
Please note that the team plans to introduce |
SocketUtils was officially deprecated in 5.3.16 (spring-projectsgh-28052) and removed in 6.0 M3 (spring-projectsgh-28054); however, there is still need for a subset of this functionality in integration tests for testing scenarios in which it is not possible for the system under test to select its own random port (or rely on the operating system to provide an ephemeral port). This commit therefore introduces a scaled down version in the spring-test module called TestSocketUtils which supports retrieval of a single TCP port. See spring-projectsgh-29132
SocketUtils
was introduced in Spring Framework 4.0, primarily to assist in writing integration tests which start an external server on an available random port.However, these utilities make no guarantee about the subsequent availability of a given port and are therefore unreliable.
Instead of using
SocketUtils
to find an available local port for a server, it is recommended that users rely on a server's ability to start on a random port that it selects or is assigned by the operating system. To interact with that server, the user should query the server for the port it is currently using.The text was updated successfully, but these errors were encountered: