Deprecate SocketUtils
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. SocketUtils is now deprecated in 5.3.16 and will be removed in 6.0. Closes gh-28052
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,6 @@ import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.beans.testfixture.beans.ITestBean;
|
||||
import org.springframework.beans.testfixture.beans.TestBean;
|
||||
import org.springframework.remoting.RemoteAccessException;
|
||||
import org.springframework.util.SocketUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
@@ -109,7 +108,7 @@ public class CauchoRemotingTests {
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void simpleHessianServiceExporter() throws IOException {
|
||||
final int port = SocketUtils.findAvailableTcpPort();
|
||||
final int port = org.springframework.util.SocketUtils.findAvailableTcpPort();
|
||||
|
||||
TestBean tb = new TestBean("tb");
|
||||
SimpleHessianServiceExporter exporter = new SimpleHessianServiceExporter();
|
||||
|
||||
Reference in New Issue
Block a user