Adds notes about fields in types explicitly new'ed

This commit is contained in:
Adrian Cole
2016-01-13 12:01:06 +08:00
parent 582cd157dc
commit b45bfa2c24
2 changed files with 6 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ import java.net.InetAddress;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.sleuth.Span;
import org.springframework.util.Assert;
/**
* An {@link HostLocator} that tries to find local service information from a
@@ -35,6 +36,7 @@ public class DiscoveryClientHostLocator implements HostLocator {
public DiscoveryClientHostLocator(DiscoveryClient client) {
this.client = client;
Assert.notNull(this.client, "client");
}
@Override

View File

@@ -20,6 +20,7 @@ import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent;
import org.springframework.cloud.sleuth.Span;
import org.springframework.context.event.EventListener;
import org.springframework.util.Assert;
/**
* @author Dave Syer
@@ -27,14 +28,15 @@ import org.springframework.context.event.EventListener;
*/
public class ServerPropertiesHostLocator implements HostLocator {
private final ServerProperties serverProperties;
private final ServerProperties serverProperties; // Nullable
private final String appName;
private Integer port;
private Integer port; // Lazy assigned
public ServerPropertiesHostLocator(ServerProperties serverProperties,
String appName) {
this.serverProperties = serverProperties;
this.appName = appName;
Assert.notNull(this.appName, "appName");
}
@Override