무중단 배포 테스트중

This commit is contained in:
jinia91
2021-12-17 01:17:54 +09:00
parent 7220da3b82
commit bedbf9f7f6
3 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package myblog.blog.main;
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;
import java.util.List;
@RequiredArgsConstructor
@RestController
public class ProfileController {
private final Environment env;
@GetMapping("/profile")
public String profile(){
List<String> profiles = Arrays.asList(env.getActiveProfiles());
List<String> realProfiles = Arrays.asList("real", "real1", "real2");
String defaultProfile = profiles.isEmpty()? "default" : profiles.get(0);
return profiles.stream()
.filter(realProfiles::contains)
.findAny()
.orElse(defaultProfile);
}
}

View File

@@ -0,0 +1,6 @@
server:
port: 8081
spring:
profiles:
include: dev

View File

@@ -0,0 +1,6 @@
server:
port: 8082
spring:
profiles:
include: dev