Skip to content

Commit 27ac337

Browse files
committed
Remove deprecated constructor.
1 parent e38cd1e commit 27ac337

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaController.java

+6-19
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,6 @@ public class EurekaController {
6060

6161
private final EurekaProperties eurekaProperties;
6262

63-
/**
64-
* @deprecated in favour of
65-
* {@link EurekaController#EurekaController(ApplicationInfoManager, EurekaProperties)}
66-
*/
67-
@Deprecated
68-
public EurekaController(ApplicationInfoManager applicationInfoManager) {
69-
this(applicationInfoManager, null);
70-
}
71-
7263
public EurekaController(ApplicationInfoManager applicationInfoManager, EurekaProperties eurekaProperties) {
7364
this.applicationInfoManager = applicationInfoManager;
7465
this.eurekaProperties = eurekaProperties;
@@ -128,14 +119,8 @@ protected void populateBase(HttpServletRequest request, Map<String, Object> mode
128119
private void populateHeader(Map<String, Object> model) {
129120
model.put("currentTime", StatusResource.getCurrentTimeAsString());
130121
model.put("upTime", StatusInfo.getUpTime());
131-
if (eurekaProperties != null) {
132-
model.put("environment", eurekaProperties.getEnvironment());
133-
model.put("datacenter", eurekaProperties.getDatacenter());
134-
}
135-
else {
136-
model.put("environment", "N/A");
137-
model.put("datacenter", "N/A");
138-
}
122+
model.put("environment", eurekaProperties.getEnvironment());
123+
model.put("datacenter", eurekaProperties.getDatacenter());
139124
PeerAwareInstanceRegistry registry = getRegistry();
140125
model.put("registry", registry);
141126
model.put("isBelowRenewThreshold", registry.isBelowRenewThresold() == 1);
@@ -159,7 +144,8 @@ private EurekaServerContext getServerContext() {
159144

160145
private void populateNavbar(HttpServletRequest request, Map<String, Object> model) {
161146
Map<String, String> replicas = new LinkedHashMap<>();
162-
List<PeerEurekaNode> list = getServerContext().getPeerEurekaNodes().getPeerNodesView();
147+
List<PeerEurekaNode> list = getServerContext().getPeerEurekaNodes()
148+
.getPeerNodesView();
163149
for (PeerEurekaNode node : list) {
164150
try {
165151
URI uri = new URI(node.getServiceUrl());
@@ -295,7 +281,8 @@ private String scrubBasicAuth(String urlList) {
295281
StringBuilder filteredUrls = new StringBuilder();
296282
for (String u : urls) {
297283
if (u.contains("@")) {
298-
filteredUrls.append(u, 0, u.indexOf("//") + 2).append(u.substring(u.indexOf("@") + 1)).append(",");
284+
filteredUrls.append(u, 0, u.indexOf("//") + 2)
285+
.append(u.substring(u.indexOf("@") + 1)).append(",");
299286
}
300287
else {
301288
filteredUrls.append(u).append(",");

spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerReplicasTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void testFilterReplicasNoAuth() throws Exception {
7777
StatusInfo statusInfo = StatusInfo.Builder.newBuilder().add("registered-replicas", empty)
7878
.add("available-replicas", noAuthList1).add("unavailable-replicas", noAuthList2)
7979
.withInstanceInfo(this.instanceInfo).build();
80-
EurekaController controller = new EurekaController(null);
80+
EurekaController controller = new EurekaController(null, new EurekaProperties());
8181

8282
controller.filterReplicas(model, statusInfo);
8383

@@ -95,7 +95,7 @@ void testFilterReplicasAuth() throws Exception {
9595
StatusInfo statusInfo = StatusInfo.Builder.newBuilder().add("registered-replicas", authList2)
9696
.add("available-replicas", authList1).add("unavailable-replicas", empty).withInstanceInfo(instanceInfo)
9797
.build();
98-
EurekaController controller = new EurekaController(null);
98+
EurekaController controller = new EurekaController(null, new EurekaProperties());
9999

100100
controller.filterReplicas(model, statusInfo);
101101

@@ -113,7 +113,7 @@ void testFilterReplicasAuthWithCombinationList() throws Exception {
113113
StatusInfo statusInfo = StatusInfo.Builder.newBuilder().add("registered-replicas", totalAutoList)
114114
.add("available-replicas", combinationAuthList1).add("unavailable-replicas", combinationAuthList2)
115115
.withInstanceInfo(instanceInfo).build();
116-
EurekaController controller = new EurekaController(null);
116+
EurekaController controller = new EurekaController(null, new EurekaProperties());
117117

118118
controller.filterReplicas(model, statusInfo);
119119

0 commit comments

Comments
 (0)