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); + } +}