提交 c195dd98 编写于 作者: 木下藤吉郎's avatar 木下藤吉郎

Merge branch '初始化配置_张凯_20210416' into 'master'

优化

See merge request !14
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<String, Object> getServerInfo() {
Map<String, Object> 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;
}
}
#
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
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册