Tabnine Logo
SocketUtils.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.springframework.util.SocketUtils
constructor

Best Java code snippets using org.springframework.util.SocketUtils.<init> (Showing top 1 results out of 315)

origin: spring-projects/spring-framework

@Test
public void canBeInstantiated() {
  // Just making sure somebody doesn't try to make SocketUtils abstract,
  // since that would be a breaking change due to the intentional public
  // constructor.
  new SocketUtils();
}
org.springframework.utilSocketUtils<init>

Javadoc

Although SocketUtils consists solely of static utility methods, this constructor is intentionally public.

Rationale

Static methods from this class may be invoked from within XML configuration files using the Spring Expression Language (SpEL) and the following syntax.

<bean id="bean1" ... p:port="#{T(org.springframework.util.SocketUtils).findAvailableTcpPort(12000)}" />
If this constructor were private, you would be required to supply the fully qualified class name to SpEL's T() function for each usage. Thus, the fact that this constructor is public allows you to reduce boilerplate configuration with SpEL as can be seen in the following example.
<bean id="socketUtils" class="org.springframework.util.SocketUtils" /> 
<bean id="bean1" ... p:port="#{socketUtils.findAvailableTcpPort(12000)}" /> 
<bean id="bean2" ... p:port="#{socketUtils.findAvailableTcpPort(30000)}" />

Popular methods of SocketUtils

  • findAvailableTcpPort
    Find an available TCP port randomly selected from the range [ minPort, maxPort].
  • findAvailableUdpPort
    Find an available UDP port randomly selected from the range [ minPort, maxPort].
  • findAvailableTcpPorts
    Find the requested number of available TCP ports, each randomly selected from the range [ minPort, m
  • findAvailableUdpPorts
    Find the requested number of available UDP ports, each randomly selected from the range [ minPort, m

Popular in Java

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • getSharedPreferences (Context)
  • setRequestProperty (URLConnection)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now