Browse Source

增加负载均衡测试服务

dev_shibei_match
wxz 5 years ago
parent
commit
7b38960810
  1. 21
      gov-access-lb/gov-access-lb-server/src/main/java/com/epmet/controller/LbController.java
  2. 1
      pom.xml

21
gov-access-lb/gov-access-lb-server/src/main/java/com/epmet/controller/LbController.java

@ -0,0 +1,21 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class LbController {
@Autowired
private InetUtils inetUtils;
@PostMapping("get-host")
public Result getHost() {
String ipAddress = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
return new Result().ok(ipAddress);
}
}

1
pom.xml

@ -29,7 +29,6 @@
<module>epmet-module</module>
<module>epmet-user</module>
<module>epmet-openapi</module>
<module>epmet-lb-test</module>
</modules>
<properties>

Loading…
Cancel
Save