forked from luyan/epmet-cloud-lingshan
2 changed files with 21 additions and 1 deletions
@ -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); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue