Skip to content
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

Remove the dependency to org.springframework.util.SocketUtils #1061

Closed
klu2 opened this issue Nov 28, 2022 · 3 comments · Fixed by #1062
Closed

Remove the dependency to org.springframework.util.SocketUtils #1061

klu2 opened this issue Nov 28, 2022 · 3 comments · Fixed by #1062

Comments

@klu2
Copy link
Contributor

klu2 commented Nov 28, 2022

The class org.springframework.util.SocketUtils is deprecated as of Spring 5.3.16 and to be removed in 6.0. Still, that class is being referenced in the com.playtika.test.redis.RedisProperties.

We should get rid of them, either by

  1. copying the old source code of SocketUtils into the playtika-library
  2. using another mechanism to find a free port for Redis.

The Javadoc of SocketUtils says:

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 you 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, you should query the server for the port it is currently using.

See also spring-projects/spring-boot#9382

This ticket is currently blocking the usage of Spring Boot 3

@klu2
Copy link
Contributor Author

klu2 commented Nov 28, 2022

Seems that this change was introduced only some weeks ago in #1044 (ticket #1043)

@klu2
Copy link
Contributor Author

klu2 commented Nov 28, 2022

Spring introduced org.springframework.test.util.TestSocketUtils in version 5.3.24 (see spring-projects/spring-framework#29132) which comes with Spring Boot 2.7.6, I will submit a PR for that

klu2 added a commit to cloudflightio/testcontainers-spring-boot that referenced this issue Nov 28, 2022
klu2 added a commit to cloudflightio/testcontainers-spring-boot that referenced this issue Nov 28, 2022
klu2 added a commit to cloudflightio/testcontainers-spring-boot that referenced this issue Dec 2, 2022
klu2 added a commit to cloudflightio/testcontainers-spring-boot that referenced this issue Dec 2, 2022
klu2 added a commit to cloudflightio/testcontainers-spring-boot that referenced this issue Dec 5, 2022
Fameing pushed a commit that referenced this issue Dec 6, 2022
thammerl added a commit to thammerl/testcontainers-spring-boot that referenced this issue Dec 19, 2022
 - Fixes PlaytikaOSS#1061 (again).
 - Regression introduced with PlaytikaOSS#1074.
 - PlaytikaOSS#1044 initially fixed PlaytikaOSS#1043 by changing the minimum port passed to `SocketUtils` from 1000 to 1025. PlaytikaOSS#1062 then changed the fix and additionally resolved PlaytikaOSS#1061 by replacing `SocketUtils` with `TestSocketUtils` from spring-test. PlaytikaOSS#1074 then reverted this change reintroducing the dependency to `SocketUtils`.
@thammerl
Copy link
Contributor

The dependency to SocketUtils was reintroduced in #1074. I assume this happened by accident. Therefore, I've opened #1082.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants