From 0b04b1e01418530829613f2f61aeed163fe72025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E4=B8=8B=E8=97=A4=E5=90=89=E9=83=8E?= <827908815@qq.com> Date: Wed, 21 Apr 2021 23:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eurekaserver/EurekaServerController.java | 38 ------------------- src/main/resources/application.properties | 15 ++++++++ src/main/resources/application.yml | 19 ---------- 3 files changed, 15 insertions(+), 57 deletions(-) delete mode 100644 src/main/java/com/zkcloud/eurekaserver/EurekaServerController.java create mode 100644 src/main/resources/application.properties delete mode 100644 src/main/resources/application.yml diff --git a/src/main/java/com/zkcloud/eurekaserver/EurekaServerController.java b/src/main/java/com/zkcloud/eurekaserver/EurekaServerController.java deleted file mode 100644 index fbc8d5c..0000000 --- a/src/main/java/com/zkcloud/eurekaserver/EurekaServerController.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.zkcloud.eurekaserver; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationContext; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.LinkedHashMap; -import java.util.Map; - -@RestController -@RequestMapping("/help-center") -public class EurekaServerController { - - @Autowired - private ApplicationContext context; - - @Value("${spring.application.name}") - private String applicationName; - - @Value("${server.port}") - private String serverPort; - - @GetMapping("/server-info") - public Map getServerInfo() { - Map infoMap = new LinkedHashMap<>(); - infoMap.put("applicationName", applicationName); - infoMap.put("serverPort", serverPort); - infoMap.put("status", "running"); - infoMap.put("total", context.getBeanDefinitionCount()); - infoMap.put("serverTime", System.currentTimeMillis()); - return infoMap; - } - - -} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..ca5d69e --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,15 @@ +# +server.port=8000 +# +spring.application.name=eureka-server +# +eureka.instance.instance-id=${spring.application.name}:${server.port} +eureka.instance.hostname=localhost +# +eureka.client.register-with-eureka=false +eureka.client.fetch-registry=false +eureka.client.service-url.defaultZone=http://localhost:8000/eureka +# +eureka.server.enable-self-preservation=false +# +logging.level.root=error diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml deleted file mode 100644 index 58034c8..0000000 --- a/src/main/resources/application.yml +++ /dev/null @@ -1,19 +0,0 @@ -server: - port: 8000 -spring: - application: - name: eureka-server -eureka: - instance: - instance-id: ${spring.application.name}:${server.port} - hostname: localhost - client: - register-with-eureka: false - fetch-registry: false - service-url: - defaultZone: http://localhost:8000/eureka - server: - enable-self-preservation: false -logging: - level: - root: info \ No newline at end of file -- GitLab