목차
Spring Cloud - 25. Spring Cloud Config Native
Spring Cloud - 24. Client Service 에서 Config Server 연동하기
Spring Cloud - 23. Spring Cloud Config Server 만들기
Spring Cloud - 22. Spring Cloud Config 연동 Actuator 2
Spring Cloud - 21. Spring Cloud Config 연동 Actuactor
Spring Cloud로 개발하는 마이크로서비스 애플리케이션 22 - Spring Cloud Config 연동 Actuator 2// 외부 Config를 가져오기 위한 Dependency 설정implementation 'org.springframework.cloud:spring-cloud-starter-config'implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuatorimplementation 'org.springframework.boot:spring-boot-starter-actuator'
spring: cloud: config: uri: http://127.0.0.1:8888 name: ecommerce
@SpringBootApplicationpublic class ApigatewayServiceApplication { public static void main(String[] args) { SpringApplication.run(ApigatewayServiceApplication.class, args); } @Bean public HttpTraceRepository httpTraceRepository(){ return new InMemoryHttpTraceRepository(); }}
server: port: 8080eureka: client: register-with-eureka: true fetch-registry: true service-url: defaultZone: http://localhost:8761/eurekaspring: application: name: apigateway-service cloud: gateway: default-filters: - name: GlobalFilter args: baseMessage: Spring Cloud Gateway Global Filter preLogger: true postLogger: true routes:# - id: user-service# uri: lb://USER-SERVICE# predicates:# - Path=/user-service/**# filters:# - CustomFilter - id: user-service uri: lb://USER-SERVICE predicates: - Path=/user-service/login - Method=POST filters: - RemoveRequestHeader=Cookie - RewritePath=/user-service/(?<segment>.*), /$\{segment} - id: user-service uri: lb://USER-SERVICE predicates: - Path=/user-service/users - Method=POST filters: - RemoveRequestHeader=Cookie - RewritePath=/user-service/(?<segment>.*), /$\{segment} - id: user-service uri: lb://USER-SERVICE predicates: - Path=/user-service/** - Method=GET filters: - RemoveRequestHeader=Cookie - RewritePath=/user-service/(?<segment>.*), /$\{segment} - AuthorizationHeaderFilter - id: user-service uri: lb://USER-SERVICE predicates: - Path=/user-service/actuator/** - Method=GET, POST filters: - RemoveRequestHeader=Cookie - RewritePath=/user-service/(?<segment>.*), /$\{segment} - id: catalog-service uri: lb://CATALOG-SERVICE predicates: - Path=/catalog-service/** filters: - CustomFilter - id: order-service uri: lb://ORDER-SERVICE predicates: - Path=/order-service/** filters: - CustomFiltertoken: secret: user_tokenmanagement: endpoints: web: exposure: include: refresh, health, beans, httptrace