How to read spring cloud gateway paths defined in yml?

Viewed 230

I want to read the path attribute defined in yml cofiguration of spring cloud gateway app in filter code:

spring:
  cloud:
    gateway:
      routes:
        - id: DEMO gateway service
          uri: ${DEMO_URL}
          predicates:
            - Path=/api/demo/**, /api/get/**

How can I read these paths in my code?

1 Answers

I was able to resolve this using the property file that is provided by spring cloud gateway i.e., org.springframework.cloud.gateway.config.GatewayProperties.java

Related