27 lines
778 B
Java
27 lines
778 B
Java
package com.xiang.app;
|
||
|
||
import com.google.common.collect.Maps;
|
||
import lombok.extern.slf4j.Slf4j;
|
||
import org.springframework.beans.factory.annotation.Value;
|
||
import org.springframework.web.bind.annotation.GetMapping;
|
||
import org.springframework.web.bind.annotation.RestController;
|
||
|
||
import java.util.Map;
|
||
|
||
@Slf4j
|
||
@RestController
|
||
public class HealthController {
|
||
|
||
@Value("${spring.profiles.active}")
|
||
private String env;
|
||
|
||
@GetMapping("/actuator/health")
|
||
public Map<String, String> checkHealth() {
|
||
Map<String, String> map = Maps.newHashMap();
|
||
map.put("env", env);
|
||
map.put("status", "UP");
|
||
log.info("cornucopia application health check success! listening in env:{}, now:{}", env, System.currentTimeMillis());
|
||
return map;
|
||
}
|
||
}
|