From 18950eab754a32e542f15adfbefa0d6d9e9024e9 Mon Sep 17 00:00:00 2001 From: Jin Geonwoo Date: Sat, 25 May 2024 14:40:52 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20=ED=99=98=EA=B2=BD=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=20=ED=99=95=EC=9D=B8=ED=95=98=EB=8A=94=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=95=84=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- planfit/build.gradle | 1 + .../server/controller/ProfileController.java | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 planfit/src/main/java/com/planfit/server/controller/ProfileController.java diff --git a/planfit/build.gradle b/planfit/build.gradle index 4d176f5..fe5f579 100644 --- a/planfit/build.gradle +++ b/planfit/build.gradle @@ -31,6 +31,7 @@ dependencies { annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'org.springframework.boot:spring-boot-starter-validation' + implementation 'org.springframework.boot:spring-boot-starter-actuator' } tasks.named('test') { diff --git a/planfit/src/main/java/com/planfit/server/controller/ProfileController.java b/planfit/src/main/java/com/planfit/server/controller/ProfileController.java new file mode 100644 index 0000000..ca45c4c --- /dev/null +++ b/planfit/src/main/java/com/planfit/server/controller/ProfileController.java @@ -0,0 +1,24 @@ +package com.planfit.server.controller; + +import com.planfit.server.service.UserService; +import lombok.RequiredArgsConstructor; +import org.springframework.core.env.Environment; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; + +@RequiredArgsConstructor +@RestController +public class ProfileController { + + private final Environment environment; + private static final String NULL = ""; + + @GetMapping("/profile") + public String getProfile() { + return Arrays.stream(environment.getActiveProfiles()) + .findFirst() + .orElse(NULL); + } +}