報錯內容如下:
Binding to target org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.cloud.gateway' to org.springframework.cloud.gateway.config.GatewayProperties failed: Property: spring.cloud.gateway.routes[2].predicates Value: [] Reason: 不能為空
原因及解決:
geteway的某一個路由里沒有寫predicates斷言,routes[2]就表示第三個路由,在指定的位置加上斷言就好了。
gateway的filter並不是必須寫的,但predicates是必須寫的。