Add ApiProperties
This commit is contained in:
parent
ebb0c75021
commit
d330bc8df9
|
@ -17,8 +17,15 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation 'org.projectlombok:lombok'
|
||||||
|
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-webflux'
|
||||||
implementation 'org.springframework.cloud:spring-cloud-starter-config'
|
implementation 'org.springframework.cloud:spring-cloud-starter-config'
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyManagement {
|
dependencyManagement {
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.kakaoent.cpdd.config.client1.configuration.properties;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "apis")
|
||||||
|
public class ApiProperties {
|
||||||
|
private String gateway; // client config
|
||||||
|
private String point; // server config
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.kakaoent.cpdd.config.client1.controller;
|
||||||
|
|
||||||
|
import com.kakaoent.cpdd.config.client1.configuration.properties.ApiProperties;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
@RequestMapping("/api/v1")
|
||||||
|
@RestController
|
||||||
|
public class PropertyAPIController {
|
||||||
|
|
||||||
|
private final ApiProperties apiProperties;
|
||||||
|
|
||||||
|
public PropertyAPIController(ApiProperties apiProperties) {
|
||||||
|
this.apiProperties = apiProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/apis/gateway")
|
||||||
|
public Mono<String> getGatewayUrl() {
|
||||||
|
return Mono.just(apiProperties.getGateway());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/apis/point")
|
||||||
|
public Mono<String> getPointAPIUrl() {
|
||||||
|
return Mono.just(apiProperties.getPoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
spring:
|
||||||
|
config:
|
||||||
|
activate:
|
||||||
|
on-profile: dev
|
||||||
|
|
||||||
|
apis:
|
||||||
|
gateway: http://gw.application-dev.com
|
|
@ -0,0 +1,6 @@
|
||||||
|
spring:
|
||||||
|
config:
|
||||||
|
activate:
|
||||||
|
on-profile: prod
|
||||||
|
apis:
|
||||||
|
gateway: http://gw.application.com
|
|
@ -1 +1,23 @@
|
||||||
|
server:
|
||||||
|
port: 11081
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: app1
|
||||||
|
profiles:
|
||||||
|
active: dev
|
||||||
|
group:
|
||||||
|
dev: dev,datasource-dev,redis-dev
|
||||||
|
prod: prod,datasource-prod,redis-prod
|
||||||
|
|
||||||
|
config:
|
||||||
|
import: "optional:configserver:http://localhost:11080"
|
||||||
|
|
||||||
|
logging.level:
|
||||||
|
org: TRACE
|
||||||
|
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: refresh
|
||||||
|
|
Loading…
Reference in New Issue