Migrates server-webflux properties to new namespace

Currently, prefix is spring.cloud.gateway and this is ambiguous now that server-webmvc exists.

spring.cloud.gateway.server.webflux is the new prefix

Fixes gh-3363
This commit is contained in:
spencergibb
2025-05-09 13:59:44 -04:00
parent 789b661c0b
commit 080f0cd366
89 changed files with 2777 additions and 286 deletions

View File

@@ -1,7 +1,9 @@
|===
|Name | Default | Description
|spring.cloud.gateway | |
|spring.cloud.gateway.default-filters | | List of filter definitions that are applied to every route.
|spring.cloud.gateway.discovery.locator | |
|spring.cloud.gateway.discovery.locator.enabled | `+++false+++` | Flag that enables DiscoveryClient gateway integration.
|spring.cloud.gateway.discovery.locator.filters | |
|spring.cloud.gateway.discovery.locator.include-expression | `+++true+++` | SpEL expression that will evaluate whether to include a service in gateway integration or not, defaults to: true.
@@ -19,7 +21,9 @@
|spring.cloud.gateway.filter.fallback-headers.enabled | `+++true+++` | Enables the fallback-headers filter.
|spring.cloud.gateway.filter.hystrix.enabled | `+++true+++` | Enables the hystrix filter.
|spring.cloud.gateway.filter.json-to-grpc.enabled | `+++true+++` | Enables the JSON to gRPC filter.
|spring.cloud.gateway.filter.local-response-cache | |
|spring.cloud.gateway.filter.local-response-cache.enabled | `+++false+++` | Enables the local-response-cache filter.
|spring.cloud.gateway.filter.local-response-cache.request | |
|spring.cloud.gateway.filter.local-response-cache.request.no-cache-strategy | `+++skip-update-cache-entry+++` |
|spring.cloud.gateway.filter.local-response-cache.size | | Maximum size of the cache to evict entries for this route (in KB, MB and GB).
|spring.cloud.gateway.filter.local-response-cache.time-to-live | `+++5m+++` | Time to expire a cache entry (expressed in s for seconds, m for minutes, and h for hours).
@@ -29,6 +33,7 @@
|spring.cloud.gateway.filter.prefix-path.enabled | `+++true+++` | Enables the prefix-path filter.
|spring.cloud.gateway.filter.preserve-host-header.enabled | `+++true+++` | Enables the preserve-host-header filter.
|spring.cloud.gateway.filter.redirect-to.enabled | `+++true+++` | Enables the redirect-to filter.
|spring.cloud.gateway.filter.remove-hop-by-hop | |
|spring.cloud.gateway.filter.remove-hop-by-hop.headers | |
|spring.cloud.gateway.filter.remove-hop-by-hop.order | `+++0+++` |
|spring.cloud.gateway.filter.remove-request-header.enabled | `+++true+++` | Enables the remove-request-header filter.
@@ -36,6 +41,7 @@
|spring.cloud.gateway.filter.remove-response-header.enabled | `+++true+++` | Enables the remove-response-header filter.
|spring.cloud.gateway.filter.request-header-size.enabled | `+++true+++` | Enables the request-header-size filter.
|spring.cloud.gateway.filter.request-header-to-request-uri.enabled | `+++true+++` | Enables the request-header-to-request-uri filter.
|spring.cloud.gateway.filter.request-rate-limiter | |
|spring.cloud.gateway.filter.request-rate-limiter.default-key-resolver | |
|spring.cloud.gateway.filter.request-rate-limiter.default-rate-limiter | |
|spring.cloud.gateway.filter.request-rate-limiter.enabled | `+++true+++` | Enables the request-rate-limiter filter.
@@ -47,6 +53,7 @@
|spring.cloud.gateway.filter.rewrite-request-parameter.enabled | `+++true+++` | Enables the rewrite-request-parameter filter.
|spring.cloud.gateway.filter.rewrite-response-header.enabled | `+++true+++` | Enables the rewrite-response-header filter.
|spring.cloud.gateway.filter.save-session.enabled | `+++true+++` | Enables the save-session filter.
|spring.cloud.gateway.filter.secure-headers | |
|spring.cloud.gateway.filter.secure-headers.content-security-policy | `+++default-src 'self' https:; font-src 'self' https: data:; img-src 'self' https: data:; object-src 'none'; script-src https:; style-src 'self' https: 'unsafe-inline'+++` |
|spring.cloud.gateway.filter.secure-headers.content-type-options | `+++nosniff+++` |
|spring.cloud.gateway.filter.secure-headers.default-headers | |
@@ -80,13 +87,16 @@
|spring.cloud.gateway.global-filter.remove-cached-body.enabled | `+++true+++` | Enables the remove-cached-body global filter.
|spring.cloud.gateway.global-filter.route-to-request-url.enabled | `+++true+++` | Enables the route-to-request-url global filter.
|spring.cloud.gateway.global-filter.websocket-routing.enabled | `+++true+++` | Enables the websocket-routing global filter.
|spring.cloud.gateway.globalcors | |
|spring.cloud.gateway.globalcors.add-to-simple-url-handler-mapping | `+++false+++` | If global CORS config should be added to the URL handler.
|spring.cloud.gateway.globalcors.cors-configurations | |
|spring.cloud.gateway.handler-mapping.order | `+++1+++` | The order of RoutePredicateHandlerMapping.
|spring.cloud.gateway.httpclient | |
|spring.cloud.gateway.httpclient.compression | `+++false+++` | Enables compression for Netty HttpClient.
|spring.cloud.gateway.httpclient.connect-timeout | | The connect timeout in millis, the default is 30s.
|spring.cloud.gateway.httpclient.max-header-size | | The max response header size.
|spring.cloud.gateway.httpclient.max-initial-line-length | | The max initial line length.
|spring.cloud.gateway.httpclient.pool | |
|spring.cloud.gateway.httpclient.pool.acquire-timeout | | Only for type FIXED, the maximum time in millis to wait for acquiring.
|spring.cloud.gateway.httpclient.pool.eviction-interval | `+++0+++` | Perform regular eviction checks in the background at a specified interval. Disabled by default ({@link Duration#ZERO})
|spring.cloud.gateway.httpclient.pool.leasing-strategy | `+++fifo+++` | Configures the leasing strategy for the pool (fifo or lifo), defaults to FIFO which is Netty's default.
@@ -96,6 +106,7 @@
|spring.cloud.gateway.httpclient.pool.metrics | `+++false+++` | Enables channel pools metrics to be collected and registered in Micrometer. Disabled by default.
|spring.cloud.gateway.httpclient.pool.name | `+++proxy+++` | The channel pool map name, defaults to proxy.
|spring.cloud.gateway.httpclient.pool.type | `+++elastic+++` | Type of pool for HttpClient to use (elastic, fixed or disabled).
|spring.cloud.gateway.httpclient.proxy | |
|spring.cloud.gateway.httpclient.proxy.host | | Hostname for proxy configuration of Netty HttpClient.
|spring.cloud.gateway.httpclient.proxy.non-proxy-hosts-pattern | | Regular expression (Java) for a configured list of hosts. that should be reached directly, bypassing the proxy
|spring.cloud.gateway.httpclient.proxy.password | | Password for proxy configuration of Netty HttpClient.
@@ -103,6 +114,7 @@
|spring.cloud.gateway.httpclient.proxy.type | `+++http+++` | proxyType for proxy configuration of Netty HttpClient (http, socks4 or socks5).
|spring.cloud.gateway.httpclient.proxy.username | | Username for proxy configuration of Netty HttpClient.
|spring.cloud.gateway.httpclient.response-timeout | | The response timeout.
|spring.cloud.gateway.httpclient.ssl | |
|spring.cloud.gateway.httpclient.ssl.close-notify-flush-timeout | `+++3000ms+++` | SSL close_notify flush timeout. Default to 3000 ms.
|spring.cloud.gateway.httpclient.ssl.close-notify-read-timeout | `+++0+++` | SSL close_notify read timeout. Default to 0 ms.
|spring.cloud.gateway.httpclient.ssl.handshake-timeout | `+++10000ms+++` | SSL handshake timeout. Default to 10000 ms
@@ -114,11 +126,14 @@
|spring.cloud.gateway.httpclient.ssl.ssl-bundle | | The name of the SSL bundle to use.
|spring.cloud.gateway.httpclient.ssl.trusted-x509-certificates | | Trusted certificates for verifying the remote endpoint's certificate.
|spring.cloud.gateway.httpclient.ssl.use-insecure-trust-manager | `+++false+++` | Installs the netty InsecureTrustManagerFactory. This is insecure and not suitable for production.
|spring.cloud.gateway.httpclient.websocket | |
|spring.cloud.gateway.httpclient.websocket.max-frame-payload-length | | Max frame payload length.
|spring.cloud.gateway.httpclient.websocket.proxy-ping | `+++true+++` | Proxy ping frames to downstream services, defaults to true.
|spring.cloud.gateway.httpclient.wiretap | `+++false+++` | Enables wiretap debugging for Netty HttpClient.
|spring.cloud.gateway.httpserver.wiretap | `+++false+++` | Enables wiretap debugging for Netty HttpServer.
|spring.cloud.gateway.loadbalancer | |
|spring.cloud.gateway.loadbalancer.use404 | `+++false+++` |
|spring.cloud.gateway.metrics | |
|spring.cloud.gateway.metrics.enabled | `+++false+++` | Enables the collection of metrics data.
|spring.cloud.gateway.metrics.prefix | `+++spring.cloud.gateway+++` | The prefix of all metrics emitted by gateway.
|spring.cloud.gateway.metrics.tags | | Tags map that added to metrics.
@@ -151,6 +166,7 @@
|spring.cloud.gateway.mvc.x-forwarded-request-headers-filter.proto-append | `+++true+++` | If appending X-Forwarded-Proto as a list is enabled.
|spring.cloud.gateway.mvc.x-forwarded-request-headers-filter.proto-enabled | `+++true+++` | If X-Forwarded-Proto is enabled.
|spring.cloud.gateway.observability.enabled | `+++true+++` | If Micrometer Observability support should be turned on.
|spring.cloud.gateway.oldval | | oldval doc.
|spring.cloud.gateway.predicate.after.enabled | `+++true+++` | Enables the after predicate.
|spring.cloud.gateway.predicate.before.enabled | `+++true+++` | Enables the before predicate.
|spring.cloud.gateway.predicate.between.enabled | `+++true+++` | Enables the between predicate.
@@ -166,6 +182,7 @@
|spring.cloud.gateway.predicate.remote-addr.enabled | `+++true+++` | Enables the remote-addr predicate.
|spring.cloud.gateway.predicate.weight.enabled | `+++true+++` | Enables the weight predicate.
|spring.cloud.gateway.predicate.xforwarded-remote-addr.enabled | `+++true+++` | Enables the xforwarded-remote-addr predicate.
|spring.cloud.gateway.redis-rate-limiter | |
|spring.cloud.gateway.redis-rate-limiter.burst-capacity-header | `+++X-RateLimit-Burst-Capacity+++` | The name of the header that returns the burst capacity configuration.
|spring.cloud.gateway.redis-rate-limiter.config | |
|spring.cloud.gateway.redis-rate-limiter.include-headers | `+++true+++` | Whether or not to include headers containing rate limiter information, defaults to true.
@@ -177,6 +194,168 @@
|spring.cloud.gateway.route-filter-cache-enabled | `+++false+++` | Enables the route filter cache, defaults to false.
|spring.cloud.gateway.route-refresh-listener.enabled | `+++true+++` | If RouteRefreshListener should be turned on.
|spring.cloud.gateway.routes | | List of Routes.
|spring.cloud.gateway.server.webflux.default-filters | | List of filter definitions that are applied to every route.
|spring.cloud.gateway.server.webflux.discovery.locator.enabled | `+++false+++` | Flag that enables DiscoveryClient gateway integration.
|spring.cloud.gateway.server.webflux.discovery.locator.filters | |
|spring.cloud.gateway.server.webflux.discovery.locator.include-expression | `+++true+++` | SpEL expression that will evaluate whether to include a service in gateway integration or not, defaults to: true.
|spring.cloud.gateway.server.webflux.discovery.locator.lower-case-service-id | `+++false+++` | Option to lower case serviceId in predicates and filters, defaults to false. Useful with eureka when it automatically uppercases serviceId. so MYSERIVCE, would match /myservice/**
|spring.cloud.gateway.server.webflux.discovery.locator.predicates | |
|spring.cloud.gateway.server.webflux.discovery.locator.route-id-prefix | | The prefix for the routeId, defaults to discoveryClient.getClass().getSimpleName() + "_". Service Id will be appended to create the routeId.
|spring.cloud.gateway.server.webflux.discovery.locator.url-expression | `+++'lb://'+serviceId+++` | SpEL expression that create the uri for each route, defaults to: 'lb://'+serviceId.
|spring.cloud.gateway.server.webflux.enabled | `+++true+++` | Enables gateway functionality.
|spring.cloud.gateway.server.webflux.fail-on-route-definition-error | `+++true+++` | Option to fail on route definition errors, defaults to true. Otherwise, a warning is logged.
|spring.cloud.gateway.server.webflux.filter.add-request-header.enabled | `+++true+++` | Enables the add-request-header filter.
|spring.cloud.gateway.server.webflux.filter.add-request-parameter.enabled | `+++true+++` | Enables the add-request-parameter filter.
|spring.cloud.gateway.server.webflux.filter.add-response-header.enabled | `+++true+++` | Enables the add-response-header filter.
|spring.cloud.gateway.server.webflux.filter.circuit-breaker.enabled | `+++true+++` | Enables the circuit-breaker filter.
|spring.cloud.gateway.server.webflux.filter.dedupe-response-header.enabled | `+++true+++` | Enables the dedupe-response-header filter.
|spring.cloud.gateway.server.webflux.filter.fallback-headers.enabled | `+++true+++` | Enables the fallback-headers filter.
|spring.cloud.gateway.server.webflux.filter.hystrix.enabled | `+++true+++` | Enables the hystrix filter.
|spring.cloud.gateway.server.webflux.filter.json-to-grpc.enabled | `+++true+++` | Enables the JSON to gRPC filter.
|spring.cloud.gateway.server.webflux.filter.local-response-cache.enabled | `+++false+++` | Enables the local-response-cache filter.
|spring.cloud.gateway.server.webflux.filter.local-response-cache.request.no-cache-strategy | `+++skip-update-cache-entry+++` |
|spring.cloud.gateway.server.webflux.filter.local-response-cache.size | | Maximum size of the cache to evict entries for this route (in KB, MB and GB).
|spring.cloud.gateway.server.webflux.filter.local-response-cache.time-to-live | `+++5m+++` | Time to expire a cache entry (expressed in s for seconds, m for minutes, and h for hours).
|spring.cloud.gateway.server.webflux.filter.map-request-header.enabled | `+++true+++` | Enables the map-request-header filter.
|spring.cloud.gateway.server.webflux.filter.modify-request-body.enabled | `+++true+++` | Enables the modify-request-body filter.
|spring.cloud.gateway.server.webflux.filter.modify-response-body.enabled | `+++true+++` | Enables the modify-response-body filter.
|spring.cloud.gateway.server.webflux.filter.prefix-path.enabled | `+++true+++` | Enables the prefix-path filter.
|spring.cloud.gateway.server.webflux.filter.preserve-host-header.enabled | `+++true+++` | Enables the preserve-host-header filter.
|spring.cloud.gateway.server.webflux.filter.redirect-to.enabled | `+++true+++` | Enables the redirect-to filter.
|spring.cloud.gateway.server.webflux.filter.remove-hop-by-hop.headers | |
|spring.cloud.gateway.server.webflux.filter.remove-hop-by-hop.order | `+++0+++` |
|spring.cloud.gateway.server.webflux.filter.remove-request-header.enabled | `+++true+++` | Enables the remove-request-header filter.
|spring.cloud.gateway.server.webflux.filter.remove-request-parameter.enabled | `+++true+++` | Enables the remove-request-parameter filter.
|spring.cloud.gateway.server.webflux.filter.remove-response-header.enabled | `+++true+++` | Enables the remove-response-header filter.
|spring.cloud.gateway.server.webflux.filter.request-header-size.enabled | `+++true+++` | Enables the request-header-size filter.
|spring.cloud.gateway.server.webflux.filter.request-header-to-request-uri.enabled | `+++true+++` | Enables the request-header-to-request-uri filter.
|spring.cloud.gateway.server.webflux.filter.request-rate-limiter.default-key-resolver | |
|spring.cloud.gateway.server.webflux.filter.request-rate-limiter.default-rate-limiter | |
|spring.cloud.gateway.server.webflux.filter.request-rate-limiter.enabled | `+++true+++` | Enables the request-rate-limiter filter.
|spring.cloud.gateway.server.webflux.filter.request-size.enabled | `+++true+++` | Enables the request-size filter.
|spring.cloud.gateway.server.webflux.filter.retry.enabled | `+++true+++` | Enables the retry filter.
|spring.cloud.gateway.server.webflux.filter.rewrite-location-response-header.enabled | `+++true+++` | Enables the rewrite-location-response-header filter.
|spring.cloud.gateway.server.webflux.filter.rewrite-location.enabled | `+++true+++` | Enables the rewrite-location filter.
|spring.cloud.gateway.server.webflux.filter.rewrite-path.enabled | `+++true+++` | Enables the rewrite-path filter.
|spring.cloud.gateway.server.webflux.filter.rewrite-request-parameter.enabled | `+++true+++` | Enables the rewrite-request-parameter filter.
|spring.cloud.gateway.server.webflux.filter.rewrite-response-header.enabled | `+++true+++` | Enables the rewrite-response-header filter.
|spring.cloud.gateway.server.webflux.filter.save-session.enabled | `+++true+++` | Enables the save-session filter.
|spring.cloud.gateway.server.webflux.filter.secure-headers.content-security-policy | `+++default-src 'self' https:; font-src 'self' https: data:; img-src 'self' https: data:; object-src 'none'; script-src https:; style-src 'self' https: 'unsafe-inline'+++` |
|spring.cloud.gateway.server.webflux.filter.secure-headers.content-type-options | `+++nosniff+++` |
|spring.cloud.gateway.server.webflux.filter.secure-headers.default-headers | |
|spring.cloud.gateway.server.webflux.filter.secure-headers.disable | |
|spring.cloud.gateway.server.webflux.filter.secure-headers.disabled-headers | |
|spring.cloud.gateway.server.webflux.filter.secure-headers.download-options | `+++noopen+++` |
|spring.cloud.gateway.server.webflux.filter.secure-headers.enabled | `+++true+++` | Enables the secure-headers filter.
|spring.cloud.gateway.server.webflux.filter.secure-headers.enabled-headers | |
|spring.cloud.gateway.server.webflux.filter.secure-headers.frame-options | `+++DENY+++` |
|spring.cloud.gateway.server.webflux.filter.secure-headers.permissions-policy | `+++accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), cross-origin-isolated=(), display-capture=(), document-domain=(), encrypted-media=(), execution-while-not-rendered=(), execution-while-out-of-viewport=(), fullscreen=(), geolocation=(), gyroscope=(), keyboard-map=(), magnetometer=(), microphone=(), midi=(), navigation-override=(), payment=(), picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(), usb=(), web-share=(), xr-spatial-tracking=()+++` |
|spring.cloud.gateway.server.webflux.filter.secure-headers.permitted-cross-domain-policies | `+++none+++` |
|spring.cloud.gateway.server.webflux.filter.secure-headers.referrer-policy | `+++no-referrer+++` |
|spring.cloud.gateway.server.webflux.filter.secure-headers.strict-transport-security | `+++max-age=631138519+++` |
|spring.cloud.gateway.server.webflux.filter.secure-headers.xss-protection-header | `+++1 ; mode=block+++` |
|spring.cloud.gateway.server.webflux.filter.set-path.enabled | `+++true+++` | Enables the set-path filter.
|spring.cloud.gateway.server.webflux.filter.set-request-header.enabled | `+++true+++` | Enables the set-request-header filter.
|spring.cloud.gateway.server.webflux.filter.set-request-host-header.enabled | `+++true+++` | Enables the set-request-host-header filter.
|spring.cloud.gateway.server.webflux.filter.set-response-header.enabled | `+++true+++` | Enables the set-response-header filter.
|spring.cloud.gateway.server.webflux.filter.set-status.enabled | `+++true+++` | Enables the set-status filter.
|spring.cloud.gateway.server.webflux.filter.strip-prefix.enabled | `+++true+++` | Enables the strip-prefix filter.
|spring.cloud.gateway.server.webflux.forwarded.by.enabled | `+++false+++` | Enables the Forwarded: by header part.
|spring.cloud.gateway.server.webflux.forwarded.enabled | `+++true+++` | Enables the ForwardedHeadersFilter.
|spring.cloud.gateway.server.webflux.global-filter.adapt-cached-body.enabled | `+++true+++` | Enables the adapt-cached-body global filter.
|spring.cloud.gateway.server.webflux.global-filter.forward-path.enabled | `+++true+++` | Enables the forward-path global filter.
|spring.cloud.gateway.server.webflux.global-filter.forward-routing.enabled | `+++true+++` | Enables the forward-routing global filter.
|spring.cloud.gateway.server.webflux.global-filter.load-balancer-client.enabled | `+++true+++` | Enables the load-balancer-client global filter.
|spring.cloud.gateway.server.webflux.global-filter.local-response-cache.enabled | `+++true+++` | Enables the local-response-cache filter for all routes, it allows to add a specific configuration at route level using LocalResponseCache filter.
|spring.cloud.gateway.server.webflux.global-filter.netty-routing.enabled | `+++true+++` | Enables the netty-routing global filter.
|spring.cloud.gateway.server.webflux.global-filter.netty-write-response.enabled | `+++true+++` | Enables the netty-write-response global filter.
|spring.cloud.gateway.server.webflux.global-filter.reactive-load-balancer-client.enabled | `+++true+++` | Enables the reactive-load-balancer-client global filter.
|spring.cloud.gateway.server.webflux.global-filter.remove-cached-body.enabled | `+++true+++` | Enables the remove-cached-body global filter.
|spring.cloud.gateway.server.webflux.global-filter.route-to-request-url.enabled | `+++true+++` | Enables the route-to-request-url global filter.
|spring.cloud.gateway.server.webflux.global-filter.websocket-routing.enabled | `+++true+++` | Enables the websocket-routing global filter.
|spring.cloud.gateway.server.webflux.globalcors.add-to-simple-url-handler-mapping | `+++false+++` | If global CORS config should be added to the URL handler.
|spring.cloud.gateway.server.webflux.globalcors.cors-configurations | |
|spring.cloud.gateway.server.webflux.handler-mapping.order | `+++1+++` | The order of RoutePredicateHandlerMapping.
|spring.cloud.gateway.server.webflux.httpclient.compression | `+++false+++` | Enables compression for Netty HttpClient.
|spring.cloud.gateway.server.webflux.httpclient.connect-timeout | | The connect timeout in millis, the default is 30s.
|spring.cloud.gateway.server.webflux.httpclient.max-header-size | | The max response header size.
|spring.cloud.gateway.server.webflux.httpclient.max-initial-line-length | | The max initial line length.
|spring.cloud.gateway.server.webflux.httpclient.pool.acquire-timeout | | Only for type FIXED, the maximum time in millis to wait for acquiring.
|spring.cloud.gateway.server.webflux.httpclient.pool.eviction-interval | `+++0+++` | Perform regular eviction checks in the background at a specified interval. Disabled by default ({@link Duration#ZERO})
|spring.cloud.gateway.server.webflux.httpclient.pool.leasing-strategy | `+++fifo+++` | Configures the leasing strategy for the pool (fifo or lifo), defaults to FIFO which is Netty's default.
|spring.cloud.gateway.server.webflux.httpclient.pool.max-connections | | Only for type FIXED, the maximum number of connections before starting pending acquisition on existing ones.
|spring.cloud.gateway.server.webflux.httpclient.pool.max-idle-time | | Time in millis after which the channel will be closed. If NULL, there is no max idle time.
|spring.cloud.gateway.server.webflux.httpclient.pool.max-life-time | | Duration after which the channel will be closed. If NULL, there is no max life time.
|spring.cloud.gateway.server.webflux.httpclient.pool.metrics | `+++false+++` | Enables channel pools metrics to be collected and registered in Micrometer. Disabled by default.
|spring.cloud.gateway.server.webflux.httpclient.pool.name | `+++proxy+++` | The channel pool map name, defaults to proxy.
|spring.cloud.gateway.server.webflux.httpclient.pool.type | `+++elastic+++` | Type of pool for HttpClient to use (elastic, fixed or disabled).
|spring.cloud.gateway.server.webflux.httpclient.proxy.host | | Hostname for proxy configuration of Netty HttpClient.
|spring.cloud.gateway.server.webflux.httpclient.proxy.non-proxy-hosts-pattern | | Regular expression (Java) for a configured list of hosts. that should be reached directly, bypassing the proxy
|spring.cloud.gateway.server.webflux.httpclient.proxy.password | | Password for proxy configuration of Netty HttpClient.
|spring.cloud.gateway.server.webflux.httpclient.proxy.port | | Port for proxy configuration of Netty HttpClient.
|spring.cloud.gateway.server.webflux.httpclient.proxy.type | `+++http+++` | proxyType for proxy configuration of Netty HttpClient (http, socks4 or socks5).
|spring.cloud.gateway.server.webflux.httpclient.proxy.username | | Username for proxy configuration of Netty HttpClient.
|spring.cloud.gateway.server.webflux.httpclient.response-timeout | | The response timeout.
|spring.cloud.gateway.server.webflux.httpclient.ssl.close-notify-flush-timeout | `+++3000ms+++` | SSL close_notify flush timeout. Default to 3000 ms.
|spring.cloud.gateway.server.webflux.httpclient.ssl.close-notify-read-timeout | `+++0+++` | SSL close_notify read timeout. Default to 0 ms.
|spring.cloud.gateway.server.webflux.httpclient.ssl.handshake-timeout | `+++10000ms+++` | SSL handshake timeout. Default to 10000 ms
|spring.cloud.gateway.server.webflux.httpclient.ssl.key-password | | Key password, default is same as keyStorePassword.
|spring.cloud.gateway.server.webflux.httpclient.ssl.key-store | | Keystore path for Netty HttpClient.
|spring.cloud.gateway.server.webflux.httpclient.ssl.key-store-password | | Keystore password.
|spring.cloud.gateway.server.webflux.httpclient.ssl.key-store-provider | | Keystore provider for Netty HttpClient, optional field.
|spring.cloud.gateway.server.webflux.httpclient.ssl.key-store-type | `+++JKS+++` | Keystore type for Netty HttpClient, default is JKS.
|spring.cloud.gateway.server.webflux.httpclient.ssl.ssl-bundle | | The name of the SSL bundle to use.
|spring.cloud.gateway.server.webflux.httpclient.ssl.trusted-x509-certificates | | Trusted certificates for verifying the remote endpoint's certificate.
|spring.cloud.gateway.server.webflux.httpclient.ssl.use-insecure-trust-manager | `+++false+++` | Installs the netty InsecureTrustManagerFactory. This is insecure and not suitable for production.
|spring.cloud.gateway.server.webflux.httpclient.websocket.max-frame-payload-length | | Max frame payload length.
|spring.cloud.gateway.server.webflux.httpclient.websocket.proxy-ping | `+++true+++` | Proxy ping frames to downstream services, defaults to true.
|spring.cloud.gateway.server.webflux.httpclient.wiretap | `+++false+++` | Enables wiretap debugging for Netty HttpClient.
|spring.cloud.gateway.server.webflux.httpserver.wiretap | `+++false+++` | Enables wiretap debugging for Netty HttpServer.
|spring.cloud.gateway.server.webflux.loadbalancer.use404 | `+++false+++` |
|spring.cloud.gateway.server.webflux.metrics.enabled | `+++false+++` | Enables the collection of metrics data.
|spring.cloud.gateway.server.webflux.metrics.prefix | `+++spring.cloud.gateway+++` | The prefix of all metrics emitted by gateway.
|spring.cloud.gateway.server.webflux.metrics.tags | | Tags map that added to metrics.
|spring.cloud.gateway.server.webflux.observability.enabled | `+++true+++` | If Micrometer Observability support should be turned on.
|spring.cloud.gateway.server.webflux.predicate.after.enabled | `+++true+++` | Enables the after predicate.
|spring.cloud.gateway.server.webflux.predicate.before.enabled | `+++true+++` | Enables the before predicate.
|spring.cloud.gateway.server.webflux.predicate.between.enabled | `+++true+++` | Enables the between predicate.
|spring.cloud.gateway.server.webflux.predicate.cloud-foundry-route-service.enabled | `+++true+++` | Enables the cloud-foundry-route-service predicate.
|spring.cloud.gateway.server.webflux.predicate.cookie.enabled | `+++true+++` | Enables the cookie predicate.
|spring.cloud.gateway.server.webflux.predicate.header.enabled | `+++true+++` | Enables the header predicate.
|spring.cloud.gateway.server.webflux.predicate.host.enabled | `+++true+++` | Enables the host predicate.
|spring.cloud.gateway.server.webflux.predicate.host.include-port | `+++true+++` | Include the port in matching the host name.
|spring.cloud.gateway.server.webflux.predicate.method.enabled | `+++true+++` | Enables the method predicate.
|spring.cloud.gateway.server.webflux.predicate.path.enabled | `+++true+++` | Enables the path predicate.
|spring.cloud.gateway.server.webflux.predicate.query.enabled | `+++true+++` | Enables the query predicate.
|spring.cloud.gateway.server.webflux.predicate.read-body.enabled | `+++true+++` | Enables the read-body predicate.
|spring.cloud.gateway.server.webflux.predicate.remote-addr.enabled | `+++true+++` | Enables the remote-addr predicate.
|spring.cloud.gateway.server.webflux.predicate.weight.enabled | `+++true+++` | Enables the weight predicate.
|spring.cloud.gateway.server.webflux.predicate.xforwarded-remote-addr.enabled | `+++true+++` | Enables the xforwarded-remote-addr predicate.
|spring.cloud.gateway.server.webflux.redis-rate-limiter.burst-capacity-header | `+++X-RateLimit-Burst-Capacity+++` | The name of the header that returns the burst capacity configuration.
|spring.cloud.gateway.server.webflux.redis-rate-limiter.config | |
|spring.cloud.gateway.server.webflux.redis-rate-limiter.include-headers | `+++true+++` | Whether or not to include headers containing rate limiter information, defaults to true.
|spring.cloud.gateway.server.webflux.redis-rate-limiter.remaining-header | `+++X-RateLimit-Remaining+++` | The name of the header that returns number of remaining requests during the current second.
|spring.cloud.gateway.server.webflux.redis-rate-limiter.replenish-rate-header | `+++X-RateLimit-Replenish-Rate+++` | The name of the header that returns the replenish rate configuration.
|spring.cloud.gateway.server.webflux.redis-rate-limiter.requested-tokens-header | `+++X-RateLimit-Requested-Tokens+++` | The name of the header that returns the requested tokens configuration.
|spring.cloud.gateway.server.webflux.redis-route-definition-repository.enabled | `+++true+++` | If RedisRouteDefinitionRepository should be enabled.
|spring.cloud.gateway.server.webflux.restrictive-property-accessor.enabled | `+++true+++` | Restricts method and property access in SpEL.
|spring.cloud.gateway.server.webflux.route-filter-cache-enabled | `+++false+++` | Enables the route filter cache, defaults to false.
|spring.cloud.gateway.server.webflux.route-refresh-listener.enabled | `+++true+++` | If RouteRefreshListener should be turned on.
|spring.cloud.gateway.server.webflux.routes | | List of Routes.
|spring.cloud.gateway.server.webflux.set-status.original-status-header-name | | The name of the header which contains http code of the proxied request.
|spring.cloud.gateway.server.webflux.streaming-media-types | |
|spring.cloud.gateway.server.webflux.x-forwarded.enabled | `+++true+++` | If the XForwardedHeadersFilter is enabled.
|spring.cloud.gateway.server.webflux.x-forwarded.for-append | `+++true+++` | If appending X-Forwarded-For as a list is enabled.
|spring.cloud.gateway.server.webflux.x-forwarded.for-enabled | `+++true+++` | If X-Forwarded-For is enabled.
|spring.cloud.gateway.server.webflux.x-forwarded.host-append | `+++true+++` | If appending X-Forwarded-Host as a list is enabled.
|spring.cloud.gateway.server.webflux.x-forwarded.host-enabled | `+++true+++` | If X-Forwarded-Host is enabled.
|spring.cloud.gateway.server.webflux.x-forwarded.order | `+++0+++` | The order of the XForwardedHeadersFilter.
|spring.cloud.gateway.server.webflux.x-forwarded.port-append | `+++true+++` | If appending X-Forwarded-Port as a list is enabled.
|spring.cloud.gateway.server.webflux.x-forwarded.port-enabled | `+++true+++` | If X-Forwarded-Port is enabled.
|spring.cloud.gateway.server.webflux.x-forwarded.prefix-append | `+++true+++` | If appending X-Forwarded-Prefix as a list is enabled.
|spring.cloud.gateway.server.webflux.x-forwarded.prefix-enabled | `+++true+++` | If X-Forwarded-Prefix is enabled.
|spring.cloud.gateway.server.webflux.x-forwarded.proto-append | `+++true+++` | If appending X-Forwarded-Proto as a list is enabled.
|spring.cloud.gateway.server.webflux.x-forwarded.proto-enabled | `+++true+++` | If X-Forwarded-Proto is enabled.
|spring.cloud.gateway.server.webmvc.form-filter.enabled | `+++true+++` | Enables the form-filter.
|spring.cloud.gateway.server.webmvc.forwarded-request-headers-filter.enabled | `+++true+++` | Enables the forwarded-request-headers-filter.
|spring.cloud.gateway.server.webmvc.http-client.connect-timeout | | The HttpClient connect timeout.
@@ -205,8 +384,10 @@
|spring.cloud.gateway.server.webmvc.x-forwarded-request-headers-filter.prefix-enabled | `+++true+++` | If X-Forwarded-Prefix is enabled.
|spring.cloud.gateway.server.webmvc.x-forwarded-request-headers-filter.proto-append | `+++true+++` | If appending X-Forwarded-Proto as a list is enabled.
|spring.cloud.gateway.server.webmvc.x-forwarded-request-headers-filter.proto-enabled | `+++true+++` | If X-Forwarded-Proto is enabled.
|spring.cloud.gateway.set-status | |
|spring.cloud.gateway.set-status.original-status-header-name | | The name of the header which contains http code of the proxied request.
|spring.cloud.gateway.streaming-media-types | |
|spring.cloud.gateway.x-forwarded | |
|spring.cloud.gateway.x-forwarded.enabled | `+++true+++` | If the XForwardedHeadersFilter is enabled.
|spring.cloud.gateway.x-forwarded.for-append | `+++true+++` | If appending X-Forwarded-For as a list is enabled.
|spring.cloud.gateway.x-forwarded.for-enabled | `+++true+++` | If X-Forwarded-For is enabled.

View File

@@ -20,7 +20,7 @@ management:
spring:
cloud:
gateway:
gateway.server.webflux:
httpserver:
wiretap: true
httpclient:

View File

@@ -13,7 +13,7 @@ server:
spring:
cloud:
gateway:
gateway.server.webflux:
# httpserver:
# wiretap: true
httpclient:

View File

@@ -9,5 +9,5 @@ server:
spring:
cloud:
gateway:
gateway.server.webflux:
enabled: false

View File

@@ -48,7 +48,7 @@ public class MvcFailureAnalyzerApplicationTests {
@Test
public void exceptionNotThrownWhenDisabled(CapturedOutput output) {
assertThatCode(() -> new SpringApplication(MvcFailureAnalyzerApplication.class)
.run("--spring.cloud.gateway.enabled=false", "--server.port=0")).doesNotThrowAnyException();
.run("--spring.cloud.gateway.server.webflux.enabled=false", "--server.port=0")).doesNotThrowAnyException();
assertThat(output).doesNotContain(MvcFoundOnClasspathFailureAnalyzer.MESSAGE,
MvcFoundOnClasspathFailureAnalyzer.ACTION);
}

View File

@@ -7,7 +7,7 @@ test:
spring:
cloud:
gateway:
gateway.server.webflux:
filter:
default-filters:
#- PrefixPath=/httpbin

View File

@@ -9,7 +9,7 @@ spring:
jmx:
enabled: false
cloud:
gateway:
gateway.server.webflux:
default-filters:
- PrefixPath=/httpbin
- AddResponseHeader=X-Response-Default-Foo, Default-Bar

View File

@@ -192,6 +192,11 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-testcontainers</artifactId>

View File

@@ -196,7 +196,7 @@ import org.springframework.web.reactive.socket.server.upgrade.ReactorNettyReques
* @author FuYiNan Guo
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.cloud.gateway.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.enabled", matchIfMissing = true)
@EnableConfigurationProperties
@AutoConfigureBefore({ HttpHandlerAutoConfiguration.class, WebFluxAutoConfiguration.class })
@AutoConfigureAfter({ GatewayReactiveLoadBalancerClientAutoConfiguration.class,
@@ -272,7 +272,7 @@ public class GatewayAutoConfiguration {
@Bean
@ConditionalOnClass(name = "org.springframework.cloud.client.discovery.event.HeartbeatMonitor")
@ConditionalOnProperty(prefix = GatewayProperties.PREFIX, name = ".route-refresh-listener.enabled",
@ConditionalOnProperty(prefix = GatewayProperties.PREFIX, name = "route-refresh-listener.enabled",
matchIfMissing = true)
public RouteRefreshListener routeRefreshListener(ApplicationEventPublisher publisher) {
return new RouteRefreshListener(publisher);
@@ -290,7 +290,7 @@ public class GatewayAutoConfiguration {
}
@Bean
@ConditionalOnProperty(name = "spring.cloud.gateway.globalcors.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.globalcors.enabled", matchIfMissing = true)
public CorsGatewayFilterApplicationListener corsGatewayFilterApplicationListener(
GlobalCorsProperties globalCorsProperties, RoutePredicateHandlerMapping routePredicateHandlerMapping,
RouteLocator routeLocator) {
@@ -318,9 +318,10 @@ public class GatewayAutoConfiguration {
}
@Bean
@ConditionalOnProperty(name = "spring.cloud.gateway.forwarded.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.forwarded.enabled", matchIfMissing = true)
public ForwardedHeadersFilter forwardedHeadersFilter(Environment env, ServerProperties serverProperties) {
boolean forwardedByEnabled = env.getProperty("spring.cloud.gateway.forwarded.by.enabled", Boolean.class, false);
boolean forwardedByEnabled = env.getProperty("spring.cloud.gateway.server.webflux.forwarded.by.enabled",
Boolean.class, false);
ForwardedHeadersFilter forwardedHeadersFilter = new ForwardedHeadersFilter();
forwardedHeadersFilter.setForwardedByEnabled(forwardedByEnabled);
forwardedHeadersFilter.setServerPort(serverProperties.getPort());
@@ -335,7 +336,7 @@ public class GatewayAutoConfiguration {
}
@Bean
@ConditionalOnProperty(name = "spring.cloud.gateway.x-forwarded.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.x-forwarded.enabled", matchIfMissing = true)
public XForwardedHeadersFilter xForwardedHeadersFilter() {
return new XForwardedHeadersFilter();
}
@@ -468,7 +469,8 @@ public class GatewayAutoConfiguration {
@Bean
@ConditionalOnEnabledPredicate
public HostRoutePredicateFactory hostRoutePredicateFactory(Environment env) {
boolean includePort = env.getProperty("spring.cloud.gateway.predicate.host.include-port", Boolean.class, true);
boolean includePort = env.getProperty("spring.cloud.gateway.server.webflux.predicate.host.include-port",
Boolean.class, true);
return new HostRoutePredicateFactory(includePort);
}
@@ -769,7 +771,7 @@ public class GatewayAutoConfiguration {
protected final Log logger = LogFactory.getLog(getClass());
@Bean
@ConditionalOnProperty(name = "spring.cloud.gateway.httpserver.wiretap")
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.httpserver.wiretap")
public NettyWebServerFactoryCustomizer nettyServerWiretapCustomizer(Environment environment,
ServerProperties serverProperties) {
return new NettyWebServerFactoryCustomizer(environment, serverProperties) {
@@ -853,7 +855,8 @@ public class GatewayAutoConfiguration {
protected static class GatewayActuatorConfiguration {
@Bean
@ConditionalOnProperty(name = "spring.cloud.gateway.actuator.verbose.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.actuator.verbose.enabled",
matchIfMissing = true)
@ConditionalOnAvailableEndpoint
public GatewayControllerEndpoint gatewayControllerEndpoint(List<GlobalFilter> globalFilters,
List<GatewayFilterFactory> gatewayFilters, List<RoutePredicateFactory> routePredicates,
@@ -883,7 +886,8 @@ public class GatewayAutoConfiguration {
super(ConfigurationPhase.REGISTER_BEAN);
}
@ConditionalOnProperty(name = "spring.cloud.gateway.actuator.verbose.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.actuator.verbose.enabled",
matchIfMissing = true)
static class VerboseDisabled {
}
@@ -891,7 +895,7 @@ public class GatewayAutoConfiguration {
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.cloud.gateway.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.enabled", matchIfMissing = true)
@ConditionalOnClass({ OAuth2AuthorizedClient.class, SecurityWebFilterChain.class, SecurityProperties.class })
@ConditionalOnEnabledFilter(TokenRelayGatewayFilterFactory.class)
protected static class TokenRelayConfiguration {

View File

@@ -29,7 +29,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
@AutoConfigureBefore(GatewayAutoConfiguration.class)
@ConditionalOnProperty(name = "spring.cloud.gateway.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = GatewayProperties.PREFIX + ".enabled", matchIfMissing = true)
public class GatewayClassPathWarningAutoConfiguration {
private static final Log log = LogFactory.getLog(GatewayClassPathWarningAutoConfiguration.class);

View File

@@ -38,7 +38,7 @@ import org.springframework.web.reactive.DispatcherHandler;
@AutoConfigureAfter(ContextFunctionCatalogAutoConfiguration.class)
@AutoConfigureBefore({ HttpHandlerAutoConfiguration.class, GatewayAutoConfiguration.class })
@ConditionalOnClass({ FunctionCatalog.class, DispatcherHandler.class })
@ConditionalOnProperty(name = "spring.cloud.gateway.function.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = GatewayProperties.PREFIX + ".function.enabled", matchIfMissing = true)
class GatewayFunctionAutoConfiguration {
@Bean

View File

@@ -21,7 +21,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* @author Ryan Baxter
*/
@ConfigurationProperties("spring.cloud.gateway.loadbalancer")
@ConfigurationProperties(GatewayProperties.PREFIX + ".loadbalancer")
public class GatewayLoadBalancerProperties {
private boolean use404;

View File

@@ -28,7 +28,7 @@ import org.springframework.validation.annotation.Validated;
/**
* @author Ingyu Hwang
*/
@ConfigurationProperties("spring.cloud.gateway.metrics")
@ConfigurationProperties(GatewayProperties.PREFIX + ".metrics")
@Validated
public class GatewayMetricsProperties {

View File

@@ -42,7 +42,7 @@ public class GatewayProperties {
/**
* Properties prefix.
*/
public static final String PREFIX = "spring.cloud.gateway";
public static final String PREFIX = "spring.cloud.gateway.server.webflux";
private final Log logger = LogFactory.getLog(getClass());

View File

@@ -50,7 +50,7 @@ import org.springframework.web.reactive.DispatcherHandler;
@AutoConfigureBefore(GatewayAutoConfiguration.class)
@ConditionalOnBean(ReactiveRedisTemplate.class)
@ConditionalOnClass({ RedisTemplate.class, DispatcherHandler.class })
@ConditionalOnProperty(name = "spring.cloud.gateway.redis.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = GatewayProperties.PREFIX + ".redis.enabled", matchIfMissing = true)
class GatewayRedisAutoConfiguration {
@Bean
@@ -72,7 +72,7 @@ class GatewayRedisAutoConfiguration {
}
@Bean
@ConditionalOnProperty(value = "spring.cloud.gateway.redis-route-definition-repository.enabled",
@ConditionalOnProperty(value = GatewayProperties.PREFIX + ".redis-route-definition-repository.enabled",
havingValue = "true")
@ConditionalOnClass(ReactiveRedisTemplate.class)
public RedisRouteDefinitionRepository redisRouteDefinitionRepository(

View File

@@ -36,7 +36,7 @@ import org.springframework.web.reactive.DispatcherHandler;
* @author Ryan Baxter
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.cloud.gateway.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = GatewayProperties.PREFIX + ".enabled", matchIfMissing = true)
@AutoConfigureAfter({ ReactiveResilience4JAutoConfiguration.class })
@ConditionalOnClass({ DispatcherHandler.class, ReactiveResilience4JAutoConfiguration.class,
ReactiveCircuitBreakerFactory.class, ReactiveResilience4JCircuitBreakerFactory.class })

View File

@@ -0,0 +1,183 @@
/*
* Copyright 2013-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.gateway.config;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.context.event.SpringApplicationEvent;
import org.springframework.boot.context.properties.source.ConfigurationProperty;
import org.springframework.boot.context.properties.source.ConfigurationPropertyName;
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
import org.springframework.boot.context.properties.source.IterableConfigurationPropertySource;
import org.springframework.boot.env.OriginTrackedMapPropertySource;
import org.springframework.boot.origin.Origin;
import org.springframework.boot.origin.OriginTrackedValue;
import org.springframework.boot.origin.PropertySourceOrigin;
import org.springframework.boot.origin.TextResourceOrigin;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.PropertySource;
import org.springframework.util.ClassUtils;
import org.springframework.util.LinkedMultiValueMap;
class GatewayServerWebfluxPropertiesMigrationListener implements ApplicationListener<SpringApplicationEvent> {
private static final Log logger = LogFactory.getLog(GatewayServerWebfluxPropertiesMigrationListener.class);
private static final String PROPERTIES_MIGRATOR_CLASS = "org.springframework.boot.context.properties.migrator.PropertiesMigrationListener";
private static final String DEPRECATED_ROOT = "spring.cloud.gateway";
private static final String DEPRECATED_ROUTES_LIST_KEY = DEPRECATED_ROOT + ".routes";
private static final String GATEWAY_PROPERTY_SOURCE_PREFIX = "migrategatewayflux";
private static final String NEW_ROUTES_LIST_KEY = GatewayProperties.PREFIX + ".routes";
private final List<Migration> routesMigrations = new ArrayList<>();
@Override
public void onApplicationEvent(SpringApplicationEvent event) {
// only run if spring-boot-properties-migrator is on the classpath
if (!ClassUtils.isPresent(PROPERTIES_MIGRATOR_CLASS, null)) {
return;
}
if (event instanceof ApplicationPreparedEvent preparedEvent) {
onApplicationPreparedEvent(preparedEvent);
}
if (event instanceof ApplicationReadyEvent || event instanceof ApplicationFailedEvent) {
logLegacyPropertiesReport();
}
}
private void onApplicationPreparedEvent(ApplicationPreparedEvent event) {
// find deprecated keys
ConfigurableEnvironment env = event.getApplicationContext().getEnvironment();
ConfigurationPropertySources.get(env).forEach(propertySource -> {
routesMigrations.addAll(migrate(env, propertySource, GATEWAY_PROPERTY_SOURCE_PREFIX + "routes-",
DEPRECATED_ROUTES_LIST_KEY, NEW_ROUTES_LIST_KEY));
});
}
private List<Migration> migrate(ConfigurableEnvironment env, ConfigurationPropertySource propertySource,
String propertySourcePrefix, String deprecatedKey, String newKeyPrefix) {
List<Migration> migrations = new ArrayList<>();
if (propertySource instanceof IterableConfigurationPropertySource iterableSource) {
ConfigurationPropertyName routesParentName = ConfigurationPropertyName.of(deprecatedKey);
List<ConfigurationPropertyName> matchingConfigProps = iterableSource.filter(n -> {
if (n.getNumberOfElements() < routesParentName.getNumberOfElements()) {
return false;
}
ConfigurationPropertyName chop = n.chop(routesParentName.getNumberOfElements());
return routesParentName.equals(chop);
}).stream().toList();
if (!matchingConfigProps.isEmpty()) {
String originalPropertySourceName;
if (propertySource.getUnderlyingSource() instanceof PropertySource<?> underlyingSource) {
originalPropertySourceName = underlyingSource.getName();
}
else {
originalPropertySourceName = propertySource.getUnderlyingSource().toString();
}
String newPropertySourceName = propertySourcePrefix + originalPropertySourceName;
Map<String, OriginTrackedValue> content = new LinkedHashMap<>();
// migrate to new keys
for (ConfigurationPropertyName originalPropertyName : matchingConfigProps) {
ConfigurationPropertyName suffix = originalPropertyName
.subName(routesParentName.getNumberOfElements());
ConfigurationPropertyName newProperty = ConfigurationPropertyName.of(newKeyPrefix).append(suffix);
ConfigurationProperty configurationProperty = propertySource
.getConfigurationProperty(originalPropertyName);
Object value = configurationProperty.getValue();
OriginTrackedValue originTrackedValue = OriginTrackedValue.of(value,
configurationProperty.getOrigin());
content.put(newProperty.toString(), originTrackedValue);
migrations.add(new Migration(originalPropertySourceName, originalPropertyName,
configurationProperty, newProperty));
}
env.getPropertySources()
.addBefore(originalPropertySourceName,
new OriginTrackedMapPropertySource(newPropertySourceName, content));
}
}
return migrations;
}
private void logLegacyPropertiesReport() {
// log warnings
if (!routesMigrations.isEmpty()) {
LinkedMultiValueMap<String, Migration> content = new LinkedMultiValueMap<>();
routesMigrations.forEach(migration -> content.add(migration.originalPropertySourceName(), migration));
StringBuilder report = new StringBuilder();
report.append(String
.format("%nThe use of configuration keys that have been renamed was found in the environment:%n%n"));
content.forEach((name, properties) -> {
report.append(String.format("Property source '%s':%n", name));
// properties.sort(PropertyMigration.COMPARATOR);
properties.forEach((property) -> {
ConfigurationPropertyName originalPropertyName = property.originalPropertyName();
report.append(String.format("\tKey: %s%n", originalPropertyName));
Integer lineNumber = property.determineLineNumber();
if (lineNumber != null) {
report.append(String.format("\t\tLine: %d%n", lineNumber));
}
report.append(String.format("\t\tReplacement: %s%n", property.newProperty().toString()));
});
report.append(String.format("%n"));
});
report.append(String.format("%n"));
report.append("Each configuration key has been temporarily mapped to its "
+ "replacement for your convenience. To silence this warning, please "
+ "update your configuration to use the new keys.");
report.append(String.format("%n"));
logger.warn(report.toString());
}
}
private record Migration(String originalPropertySourceName, ConfigurationPropertyName originalPropertyName,
ConfigurationProperty originalProperty, ConfigurationPropertyName newProperty) {
private Integer determineLineNumber() {
Origin origin = originalProperty.getOrigin();
if (origin instanceof PropertySourceOrigin propertySourceOrigin) {
origin = propertySourceOrigin.getOrigin();
}
if (origin instanceof TextResourceOrigin textOrigin) {
if (textOrigin.getLocation() != null) {
return textOrigin.getLocation().getLine() + 1;
}
}
return null;
}
}
}

View File

@@ -35,7 +35,7 @@ import org.springframework.web.reactive.DispatcherHandler;
@AutoConfigureAfter(BindingServiceConfiguration.class)
@AutoConfigureBefore({ HttpHandlerAutoConfiguration.class, GatewayAutoConfiguration.class })
@ConditionalOnClass({ StreamBridge.class, DispatcherHandler.class })
@ConditionalOnProperty(name = "spring.cloud.gateway.stream.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = GatewayProperties.PREFIX + ".stream.enabled", matchIfMissing = true)
class GatewayStreamAutoConfiguration {
@Bean

View File

@@ -27,7 +27,7 @@ import org.springframework.web.cors.CorsConfiguration;
* Configuration properties for global configuration of cors. See
* {@link RoutePredicateHandlerMapping}
*/
@ConfigurationProperties("spring.cloud.gateway.globalcors")
@ConfigurationProperties(GatewayProperties.PREFIX + ".globalcors")
public class GlobalCorsProperties {
private final Map<String, CorsConfiguration> corsConfigurations = new LinkedHashMap<>();

View File

@@ -32,7 +32,7 @@ import org.springframework.validation.annotation.Validated;
/**
* Configuration properties for the Netty {@link reactor.netty.http.client.HttpClient}.
*/
@ConfigurationProperties("spring.cloud.gateway.httpclient")
@ConfigurationProperties(GatewayProperties.PREFIX + ".httpclient")
@Validated
public class HttpClientProperties {

View File

@@ -108,17 +108,19 @@ public class LocalResponseCacheAutoConfiguration {
super(ConfigurationPhase.REGISTER_BEAN);
}
@ConditionalOnProperty(value = "spring.cloud.gateway.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(value = GatewayProperties.PREFIX + ".enabled", havingValue = "true",
matchIfMissing = true)
static class OnGatewayPropertyEnabled {
}
@ConditionalOnProperty(value = "spring.cloud.gateway.filter.local-response-cache.enabled", havingValue = "true")
@ConditionalOnProperty(value = GatewayProperties.PREFIX + ".filter.local-response-cache.enabled",
havingValue = "true")
static class OnLocalResponseCachePropertyEnabled {
}
@ConditionalOnProperty(name = "spring.cloud.gateway.global-filter.local-response-cache.enabled",
@ConditionalOnProperty(name = GatewayProperties.PREFIX + ".global-filter.local-response-cache.enabled",
havingValue = "true", matchIfMissing = true)
static class OnGlobalLocalResponseCachePropertyEnabled {

View File

@@ -30,7 +30,7 @@ import org.springframework.web.reactive.handler.SimpleUrlHandlerMapping;
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(SimpleUrlHandlerMapping.class)
@ConditionalOnProperty(name = "spring.cloud.gateway.globalcors.add-to-simple-url-handler-mapping",
@ConditionalOnProperty(name = GatewayProperties.PREFIX + ".globalcors.add-to-simple-url-handler-mapping",
matchIfMissing = false)
public class SimpleUrlHandlerMappingGlobalCorsAutoConfiguration {

View File

@@ -34,7 +34,7 @@ import static org.springframework.boot.autoconfigure.condition.ConditionMessage.
public abstract class OnEnabledComponent<T> extends SpringBootCondition implements ConfigurationCondition {
private static final String PREFIX = "spring.cloud.gateway.";
private static final String PREFIX = "spring.cloud.gateway.server.webflux.";
private static final String SUFFIX = ".enabled";

View File

@@ -24,7 +24,7 @@ import org.springframework.cloud.gateway.filter.FilterDefinition;
import org.springframework.cloud.gateway.handler.predicate.PredicateDefinition;
import org.springframework.core.style.ToStringCreator;
@ConfigurationProperties("spring.cloud.gateway.discovery.locator")
@ConfigurationProperties("spring.cloud.gateway.server.webflux.discovery.locator")
public class DiscoveryLocatorProperties {
/** Flag that enables DiscoveryClient gateway integration. */

View File

@@ -45,7 +45,7 @@ import static org.springframework.cloud.gateway.support.NameUtils.normalizeRoute
* @author Spencer Gibb
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.cloud.gateway.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.enabled", matchIfMissing = true)
@AutoConfigureBefore(GatewayAutoConfiguration.class)
@AutoConfigureAfter(CompositeDiscoveryClientAutoConfiguration.class)
@ConditionalOnClass({ DispatcherHandler.class, CompositeDiscoveryClientAutoConfiguration.class })
@@ -92,7 +92,7 @@ public class GatewayDiscoveryClientAutoConfiguration {
public static class ReactiveDiscoveryClientRouteDefinitionLocatorConfiguration {
@Bean
@ConditionalOnProperty(name = "spring.cloud.gateway.discovery.locator.enabled")
@ConditionalOnProperty(name = "spring.cloud.gateway.server.webflux.discovery.locator.enabled")
public DiscoveryClientRouteDefinitionLocator discoveryClientRouteDefinitionLocator(
ReactiveDiscoveryClient discoveryClient, DiscoveryLocatorProperties properties) {
return new DiscoveryClientRouteDefinitionLocator(discoveryClient, properties);

View File

@@ -34,7 +34,7 @@ import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.s
* User Request Rate Limiter filter. See https://stripe.com/blog/rate-limiters and
* https://gist.github.com/ptarjan/e38f45f2dfe601419ca3af937fff574d#file-1-check_request_rate_limiter-rb-L11-L34.
*/
@ConfigurationProperties("spring.cloud.gateway.filter.request-rate-limiter")
@ConfigurationProperties("spring.cloud.gateway.server.webflux.filter.request-rate-limiter")
public class RequestRateLimiterGatewayFilterFactory
extends AbstractGatewayFilterFactory<RequestRateLimiterGatewayFilterFactory.Config> {

View File

@@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* @author Spencer Gibb, Thirunavukkarasu Ravichandran, Jörg Richter
*/
@ConfigurationProperties("spring.cloud.gateway.filter.secure-headers")
@ConfigurationProperties("spring.cloud.gateway.server.webflux.filter.secure-headers")
public class SecureHeadersProperties {
/**

View File

@@ -35,7 +35,7 @@ import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.s
/**
* @author Spencer Gibb
*/
@ConfigurationProperties("spring.cloud.gateway.set-status")
@ConfigurationProperties("spring.cloud.gateway.server.webflux.set-status")
public class SetStatusGatewayFilterFactory extends AbstractGatewayFilterFactory<SetStatusGatewayFilterFactory.Config> {
/**

View File

@@ -40,7 +40,8 @@ import org.springframework.validation.annotation.Validated;
* @author Marta Medio
* @author Ignacio Lozano
*/
@ConditionalOnProperty(value = "spring.cloud.gateway.filter.local-response-cache.enabled", havingValue = "true")
@ConditionalOnProperty(value = "spring.cloud.gateway.server.webflux.filter.local-response-cache.enabled",
havingValue = "true")
public class LocalResponseCacheGatewayFilterFactory
extends AbstractGatewayFilterFactory<LocalResponseCacheGatewayFilterFactory.RouteCacheConfiguration> {

View File

@@ -30,7 +30,7 @@ import org.springframework.util.unit.DataSize;
@ConfigurationProperties(prefix = LocalResponseCacheProperties.PREFIX)
public class LocalResponseCacheProperties {
static final String PREFIX = "spring.cloud.gateway.filter.local-response-cache";
static final String PREFIX = "spring.cloud.gateway.server.webflux.filter.local-response-cache";
private static final Log LOGGER = LogFactory.getLog(LocalResponseCacheProperties.class);

View File

@@ -30,7 +30,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.util.Assert;
import org.springframework.web.server.ServerWebExchange;
@ConfigurationProperties("spring.cloud.gateway.filter.remove-hop-by-hop")
@ConfigurationProperties("spring.cloud.gateway.server.webflux.filter.remove-hop-by-hop")
public class RemoveHopByHopHeadersFilter implements HttpHeadersFilter, Ordered {
/**

View File

@@ -32,7 +32,7 @@ import org.springframework.web.server.ServerWebExchange;
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.GATEWAY_ORIGINAL_REQUEST_URL_ATTR;
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR;
@ConfigurationProperties("spring.cloud.gateway.x-forwarded")
@ConfigurationProperties("spring.cloud.gateway.server.webflux.x-forwarded")
public class XForwardedHeadersFilter implements HttpHeadersFilter, Ordered {
/** Default http port. */

View File

@@ -31,6 +31,7 @@ import reactor.core.publisher.Mono;
import org.springframework.beans.BeansException;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.gateway.config.GatewayProperties;
import org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator;
import org.springframework.cloud.gateway.support.ConfigurationService;
import org.springframework.context.ApplicationContext;
@@ -50,7 +51,7 @@ import org.springframework.validation.annotation.Validated;
* @author Denis Cutic
* @author Andrey Muchnik
*/
@ConfigurationProperties("spring.cloud.gateway.redis-rate-limiter")
@ConfigurationProperties(GatewayProperties.PREFIX + ".redis-rate-limiter")
public class RedisRateLimiter extends AbstractRateLimiter<RedisRateLimiter.Config> implements ApplicationContextAware {
/**

View File

@@ -183,8 +183,8 @@ public interface ShortcutConfigurable {
public GatewayEvaluationContext(BeanFactory beanFactory) {
this.beanFactoryResolver = new BeanFactoryResolver(beanFactory);
Environment env = beanFactory.getBean(Environment.class);
boolean restrictive = env.getProperty("spring.cloud.gateway.restrictive-property-accessor.enabled",
Boolean.class, true);
boolean restrictive = env.getProperty(
"spring.cloud.gateway.server.webflux.restrictive-property-accessor.enabled", Boolean.class, true);
if (restrictive) {
delegate = SimpleEvaluationContext.forPropertyAccessors(new RestrictivePropertyAccessor())
.withMethodResolvers((context, targetObject, name, argumentTypes) -> null)

View File

@@ -3,4 +3,8 @@ org.springframework.cloud.gateway.config.GatewayEnvironmentPostProcessor
# Failure Analyzers
org.springframework.boot.diagnostics.FailureAnalyzer=\
org.springframework.cloud.gateway.support.MvcFoundOnClasspathFailureAnalyzer
org.springframework.cloud.gateway.support.MvcFoundOnClasspathFailureAnalyzer
# Application Listeners
org.springframework.context.ApplicationListener=\
org.springframework.cloud.gateway.config.GatewayServerWebfluxPropertiesMigrationListener

View File

@@ -118,19 +118,20 @@ public class GatewayAutoConfigurationTests {
.withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.class, MetricsAutoConfiguration.class,
SimpleMetricsExportAutoConfiguration.class, GatewayAutoConfiguration.class,
HttpClientCustomizedConfig.class, ServerPropertiesConfig.class))
.withPropertyValues("spring.cloud.gateway.httpclient.ssl.use-insecure-trust-manager=true",
"spring.cloud.gateway.httpclient.ssl.ssl-bundle=mybundle",
"spring.cloud.gateway.httpclient.connect-timeout=10",
"spring.cloud.gateway.httpclient.response-timeout=10s",
"spring.cloud.gateway.httpclient.pool.eviction-interval=10s",
"spring.cloud.gateway.httpclient.pool.type=fixed",
"spring.cloud.gateway.httpclient.pool.metrics=true",
"spring.cloud.gateway.httpclient.pool.leasing-strategy=lifo",
"spring.cloud.gateway.httpclient.compression=true", "spring.cloud.gateway.httpclient.wiretap=true",
.withPropertyValues("spring.cloud.gateway.server.webflux.httpclient.ssl.use-insecure-trust-manager=true",
"spring.cloud.gateway.server.webflux.httpclient.ssl.ssl-bundle=mybundle",
"spring.cloud.gateway.server.webflux.httpclient.connect-timeout=10",
"spring.cloud.gateway.server.webflux.httpclient.response-timeout=10s",
"spring.cloud.gateway.server.webflux.httpclient.pool.eviction-interval=10s",
"spring.cloud.gateway.server.webflux.httpclient.pool.type=fixed",
"spring.cloud.gateway.server.webflux.httpclient.pool.metrics=true",
"spring.cloud.gateway.server.webflux.httpclient.pool.leasing-strategy=lifo",
"spring.cloud.gateway.server.webflux.httpclient.compression=true",
"spring.cloud.gateway.server.webflux.httpclient.wiretap=true",
// greater than integer max value
"spring.cloud.gateway.httpclient.max-initial-line-length=2147483647",
"spring.cloud.gateway.httpclient.proxy.host=myhost",
"spring.cloud.gateway.httpclient.websocket.max-frame-payload-length=1024")
"spring.cloud.gateway.server.webflux.httpclient.max-initial-line-length=2147483647",
"spring.cloud.gateway.server.webflux.httpclient.proxy.host=myhost",
"spring.cloud.gateway.server.webflux.httpclient.websocket.max-frame-payload-length=1024")
.run(context -> {
assertThat(context).hasSingleBean(HttpClient.class);
HttpClient httpClient = context.getBean(HttpClient.class);
@@ -185,7 +186,7 @@ public class GatewayAutoConfigurationTests {
@Test
public void verboseActuatorDisabled() {
try (ConfigurableApplicationContext ctx = SpringApplication.run(Config.class, "--spring.jmx.enabled=false",
"--server.port=0", "--spring.cloud.gateway.actuator.verbose.enabled=false",
"--server.port=0", "--spring.cloud.gateway.server.webflux.actuator.verbose.enabled=false",
"--management.endpoint.gateway.enabled=true")) {
assertThat(ctx.getBeanNamesForType(GatewayLegacyControllerEndpoint.class)).hasSize(1);
}
@@ -233,7 +234,8 @@ public class GatewayAutoConfigurationTests {
public void noTokenRelayFilter() {
assertThatThrownBy(() -> {
try (ConfigurableApplicationContext ctx = SpringApplication.run(RouteLocatorBuilderConfig.class,
"--spring.jmx.enabled=false", "--spring.cloud.gateway.filter.token-relay.enabled=false",
"--spring.jmx.enabled=false",
"--spring.cloud.gateway.server.webflux.filter.token-relay.enabled=false",
"--spring.security.oauth2.client.provider[testprovider].authorization-uri=http://localhost",
"--spring.security.oauth2.client.provider[testprovider].token-uri=http://localhost/token",
"--spring.security.oauth2.client.registration[test].provider=testprovider",

View File

@@ -88,7 +88,7 @@ public class GatewayMetricsAutoConfigurationTests {
}
@Nested
@SpringBootTest(classes = Config.class, properties = "spring.cloud.gateway.metrics.enabled=false")
@SpringBootTest(classes = Config.class, properties = GatewayProperties.PREFIX + ".metrics.enabled=false")
public class DisabledByProperty {
@Autowired(required = false)
@@ -110,7 +110,7 @@ public class GatewayMetricsAutoConfigurationTests {
}
@Nested
@SpringBootTest(classes = Config.class, properties = "spring.cloud.gateway.observability.enabled=false")
@SpringBootTest(classes = Config.class, properties = GatewayProperties.PREFIX + ".observability.enabled=false")
public class ObservabilityDisabledByProperty {
@Autowired

View File

@@ -0,0 +1,71 @@
/*
* Copyright 2013-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.gateway.config;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.cloud.gateway.filter.factory.AddRequestParameterGatewayFilterFactory;
import org.springframework.cloud.gateway.filter.headers.ForwardedHeadersFilter;
import org.springframework.cloud.gateway.filter.headers.XForwardedHeadersFilter;
import org.springframework.cloud.gateway.handler.predicate.AfterRoutePredicateFactory;
import org.springframework.cloud.gateway.route.RouteRefreshListener;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ActiveProfiles;
import static org.assertj.core.api.Assertions.assertThat;
@SuppressWarnings("unchecked")
@SpringBootTest(properties = { "debug=true" }, webEnvironment = WebEnvironment.RANDOM_PORT)
@ActiveProfiles("propertiesmigrationtests")
public class GatewayPropertiesMigrationTests {
@Autowired
ApplicationContext context;
@Autowired
GatewayProperties properties;
@Test
public void deprecatedPropertiesWork() {
assertBeanDoesNotExist(AddRequestParameterGatewayFilterFactory.class);
assertBeanDoesNotExist(AfterRoutePredicateFactory.class);
assertBeanDoesNotExist(ForwardedHeadersFilter.class);
assertBeanDoesNotExist(RouteRefreshListener.class);
assertBeanDoesNotExist(XForwardedHeadersFilter.class);
}
@Test
public void deprecatedRoutePropertiesWork() {
assertThat(properties.getRoutes()).hasSize(2);
}
private void assertBeanDoesNotExist(Class<?> type) {
assertThat(context.getBeanNamesForType(type)).isEmpty();
}
@SpringBootConfiguration
@EnableAutoConfiguration
protected static class TestConfiguration {
}
}

View File

@@ -75,7 +75,7 @@ public class GatewayRedisAutoConfigurationTests {
}
@Nested
@SpringBootTest(classes = Config.class, properties = "spring.cloud.gateway.redis.enabled=false")
@SpringBootTest(classes = Config.class, properties = GatewayProperties.PREFIX + ".redis.enabled=false")
class DisabledByProperty {
@Autowired(required = false)
@@ -97,7 +97,7 @@ public class GatewayRedisAutoConfigurationTests {
*/
@Nested
@SpringBootTest(classes = GatewayRedisAutoConfigurationTests.Config.class,
properties = "spring.cloud.gateway.redis-route-definition-repository.enabled=false")
properties = GatewayProperties.PREFIX + ".redis-route-definition-repository.enabled=false")
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
class RedisRouteDefinitionRepositoryDisabledByProperty {

View File

@@ -33,7 +33,7 @@ import org.springframework.test.context.DynamicPropertySource;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(classes = GatewayRedisAutoConfigurationTests.Config.class,
properties = "spring.cloud.gateway.redis-route-definition-repository.enabled=true")
properties = GatewayProperties.PREFIX + ".redis-route-definition-repository.enabled=true")
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
@Testcontainers
@Tag("DockerRequired")

View File

@@ -33,7 +33,7 @@ public class LocalResponseCacheAutoConfigurationTests {
void onlyOneCacheManagerBeanCreated() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(LocalResponseCacheAutoConfiguration.class))
.withPropertyValues("spring.cloud.gateway.filter.local-response-cache.enabled=true")
.withPropertyValues(GatewayProperties.PREFIX + ".filter.local-response-cache.enabled=true")
.run(context -> {
context.containsBean(LocalResponseCacheAutoConfiguration.RESPONSE_CACHE_MANAGER_NAME);
context.assertThat().hasSingleBean(GlobalLocalResponseCacheGatewayFilter.class);
@@ -45,7 +45,7 @@ public class LocalResponseCacheAutoConfigurationTests {
new ApplicationContextRunner()
.withConfiguration(
AutoConfigurations.of(CustomCacheManagerConfig.class, LocalResponseCacheAutoConfiguration.class))
.withPropertyValues("spring.cloud.gateway.filter.local-response-cache.enabled=true")
.withPropertyValues(GatewayProperties.PREFIX + ".filter.local-response-cache.enabled=true")
.run(context -> {
context.containsBean(LocalResponseCacheAutoConfiguration.RESPONSE_CACHE_MANAGER_NAME);
context.containsBean("myCacheManager");

View File

@@ -56,8 +56,8 @@ public class DisableBuiltInFiltersTests {
@Nested
@SpringBootTest(classes = Config.class,
properties = { "spring.cloud.gateway.filter.add-request-header.enabled=false",
"spring.cloud.gateway.filter.map-request-header.enabled=false" })
properties = { "spring.cloud.gateway.server.webflux.filter.add-request-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.map-request-header.enabled=false" })
@ActiveProfiles("disable-components")
public class DisableSpecificsFiltersByProperty {
@@ -76,45 +76,45 @@ public class DisableBuiltInFiltersTests {
@Nested
@SpringBootTest(classes = Config.class,
properties = { "spring.cloud.gateway.filter.add-request-header.enabled=false",
"spring.cloud.gateway.filter.map-request-header.enabled=false",
"spring.cloud.gateway.filter.add-request-headers-if-not-present.enabled=false",
"spring.cloud.gateway.filter.add-request-parameter.enabled=false",
"spring.cloud.gateway.filter.add-response-header.enabled=false",
"spring.cloud.gateway.filter.json-to-grpc.enabled=false",
"spring.cloud.gateway.filter.modify-request-body.enabled=false",
"spring.cloud.gateway.filter.local-response-cache.enabled=false",
"spring.cloud.gateway.filter.dedupe-response-header.enabled=false",
"spring.cloud.gateway.filter.modify-response-body.enabled=false",
"spring.cloud.gateway.filter.prefix-path.enabled=false",
"spring.cloud.gateway.filter.preserve-host-header.enabled=false",
"spring.cloud.gateway.filter.redirect-to.enabled=false",
"spring.cloud.gateway.filter.remove-json-attributes-response-body.enabled=false",
"spring.cloud.gateway.filter.remove-request-header.enabled=false",
"spring.cloud.gateway.filter.remove-request-parameter.enabled=false",
"spring.cloud.gateway.filter.remove-response-header.enabled=false",
"spring.cloud.gateway.filter.request-rate-limiter.enabled=false",
"spring.cloud.gateway.filter.rewrite-path.enabled=false",
"spring.cloud.gateway.filter.retry.enabled=false",
"spring.cloud.gateway.filter.set-path.enabled=false",
"spring.cloud.gateway.filter.secure-headers.enabled=false",
"spring.cloud.gateway.filter.set-request-header.enabled=false",
"spring.cloud.gateway.filter.set-request-host-header.enabled=false",
"spring.cloud.gateway.filter.set-response-header.enabled=false",
"spring.cloud.gateway.filter.rewrite-response-header.enabled=false",
"spring.cloud.gateway.filter.rewrite-location-response-header.enabled=false",
"spring.cloud.gateway.filter.rewrite-location.enabled=false",
"spring.cloud.gateway.filter.rewrite-request-parameter.enabled=false",
"spring.cloud.gateway.filter.set-status.enabled=false",
"spring.cloud.gateway.filter.save-session.enabled=false",
"spring.cloud.gateway.filter.strip-prefix.enabled=false",
"spring.cloud.gateway.filter.request-header-to-request-uri.enabled=false",
"spring.cloud.gateway.filter.request-size.enabled=false",
"spring.cloud.gateway.filter.request-header-size.enabled=false",
"spring.cloud.gateway.filter.circuit-breaker.enabled=false",
"spring.cloud.gateway.filter.token-relay.enabled=false",
"spring.cloud.gateway.filter.cache-request-body.enabled=false",
"spring.cloud.gateway.filter.fallback-headers.enabled=false" })
properties = { "spring.cloud.gateway.server.webflux.filter.add-request-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.map-request-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.add-request-headers-if-not-present.enabled=false",
"spring.cloud.gateway.server.webflux.filter.add-request-parameter.enabled=false",
"spring.cloud.gateway.server.webflux.filter.add-response-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.json-to-grpc.enabled=false",
"spring.cloud.gateway.server.webflux.filter.modify-request-body.enabled=false",
"spring.cloud.gateway.server.webflux.filter.local-response-cache.enabled=false",
"spring.cloud.gateway.server.webflux.filter.dedupe-response-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.modify-response-body.enabled=false",
"spring.cloud.gateway.server.webflux.filter.prefix-path.enabled=false",
"spring.cloud.gateway.server.webflux.filter.preserve-host-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.redirect-to.enabled=false",
"spring.cloud.gateway.server.webflux.filter.remove-json-attributes-response-body.enabled=false",
"spring.cloud.gateway.server.webflux.filter.remove-request-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.remove-request-parameter.enabled=false",
"spring.cloud.gateway.server.webflux.filter.remove-response-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.request-rate-limiter.enabled=false",
"spring.cloud.gateway.server.webflux.filter.rewrite-path.enabled=false",
"spring.cloud.gateway.server.webflux.filter.retry.enabled=false",
"spring.cloud.gateway.server.webflux.filter.set-path.enabled=false",
"spring.cloud.gateway.server.webflux.filter.secure-headers.enabled=false",
"spring.cloud.gateway.server.webflux.filter.set-request-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.set-request-host-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.set-response-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.rewrite-response-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.rewrite-location-response-header.enabled=false",
"spring.cloud.gateway.server.webflux.filter.rewrite-location.enabled=false",
"spring.cloud.gateway.server.webflux.filter.rewrite-request-parameter.enabled=false",
"spring.cloud.gateway.server.webflux.filter.set-status.enabled=false",
"spring.cloud.gateway.server.webflux.filter.save-session.enabled=false",
"spring.cloud.gateway.server.webflux.filter.strip-prefix.enabled=false",
"spring.cloud.gateway.server.webflux.filter.request-header-to-request-uri.enabled=false",
"spring.cloud.gateway.server.webflux.filter.request-size.enabled=false",
"spring.cloud.gateway.server.webflux.filter.request-header-size.enabled=false",
"spring.cloud.gateway.server.webflux.filter.circuit-breaker.enabled=false",
"spring.cloud.gateway.server.webflux.filter.token-relay.enabled=false",
"spring.cloud.gateway.server.webflux.filter.cache-request-body.enabled=false",
"spring.cloud.gateway.server.webflux.filter.fallback-headers.enabled=false" })
@ActiveProfiles("disable-components")
public class DisableAllFiltersByProperty {

View File

@@ -56,8 +56,8 @@ public class DisableBuiltInGlobalFiltersTests {
@Nested
@SpringBootTest(classes = Config.class,
properties = { "spring.cloud.gateway.global-filter.remove-cached-body.enabled=false",
"spring.cloud.gateway.global-filter.route-to-request-url.enabled=false" })
properties = { "spring.cloud.gateway.server.webflux.global-filter.remove-cached-body.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.route-to-request-url.enabled=false" })
@ActiveProfiles("disable-components")
public class DisableSpecificsFiltersByProperty {
@@ -74,21 +74,21 @@ public class DisableBuiltInGlobalFiltersTests {
}
@Nested
@SpringBootTest(classes = Config.class,
properties = { "spring.cloud.gateway.global-filter.adapt-cached-body.enabled=false",
"spring.cloud.gateway.global-filter.remove-cached-body.enabled=false",
"spring.cloud.gateway.global-filter.route-to-request-url.enabled=false",
"spring.cloud.gateway.global-filter.forward-routing.enabled=false",
"spring.cloud.gateway.global-filter.forward-path.enabled=false",
"spring.cloud.gateway.global-filter.websocket-routing.enabled=false",
"spring.cloud.gateway.global-filter.netty-write-response.enabled=false",
"spring.cloud.gateway.global-filter.netty-routing.enabled=false",
"spring.cloud.gateway.global-filter.reactive-load-balancer-client.enabled=false",
"spring.cloud.gateway.global-filter.load-balancer-client.enabled=false",
"spring.cloud.gateway.global-filter.load-balancer-service-instance-cookie.enabled=false",
"spring.cloud.gateway.global-filter.function-routing.enabled=false",
"spring.cloud.gateway.global-filter.stream-routing.enabled=false",
"spring.cloud.gateway.metrics.enabled=false" })
@SpringBootTest(classes = Config.class, properties = {
"spring.cloud.gateway.server.webflux.global-filter.adapt-cached-body.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.remove-cached-body.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.route-to-request-url.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.forward-routing.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.forward-path.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.websocket-routing.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.netty-write-response.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.netty-routing.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.reactive-load-balancer-client.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.load-balancer-client.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.load-balancer-service-instance-cookie.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.function-routing.enabled=false",
"spring.cloud.gateway.server.webflux.global-filter.stream-routing.enabled=false",
"spring.cloud.gateway.server.webflux.metrics.enabled=false" })
@ActiveProfiles("disable-components")
public class DisableAllGlobalFiltersByProperty {

View File

@@ -56,8 +56,8 @@ public class DisableBuiltInPredicatesTests {
@Nested
@SpringBootTest(classes = Config.class,
properties = { "spring.cloud.gateway.predicate.after.enabled=false",
"spring.cloud.gateway.predicate.before.enabled=false" })
properties = { "spring.cloud.gateway.server.webflux.predicate.after.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.before.enabled=false" })
@ActiveProfiles("disable-components")
public class DisableSpecificsPredicatesByProperty {
@@ -74,18 +74,21 @@ public class DisableBuiltInPredicatesTests {
}
@Nested
@SpringBootTest(classes = Config.class, properties = { "spring.cloud.gateway.predicate.after.enabled=false",
"spring.cloud.gateway.predicate.before.enabled=false",
"spring.cloud.gateway.predicate.between.enabled=false",
"spring.cloud.gateway.predicate.cookie.enabled=false",
"spring.cloud.gateway.predicate.header.enabled=false", "spring.cloud.gateway.predicate.host.enabled=false",
"spring.cloud.gateway.predicate.method.enabled=false", "spring.cloud.gateway.predicate.path.enabled=false",
"spring.cloud.gateway.predicate.query.enabled=false",
"spring.cloud.gateway.predicate.read-body.enabled=false",
"spring.cloud.gateway.predicate.remote-addr.enabled=false",
"spring.cloud.gateway.predicate.xforwarded-remote-addr.enabled=false",
"spring.cloud.gateway.predicate.weight.enabled=false",
"spring.cloud.gateway.predicate.cloud-foundry-route-service.enabled=false" })
@SpringBootTest(classes = Config.class,
properties = { "spring.cloud.gateway.server.webflux.predicate.after.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.before.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.between.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.cookie.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.header.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.host.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.method.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.path.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.query.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.read-body.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.remote-addr.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.xforwarded-remote-addr.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.weight.enabled=false",
"spring.cloud.gateway.server.webflux.predicate.cloud-foundry-route-service.enabled=false" })
@ActiveProfiles("disable-components")
public class DisableAllPredicatesByProperty {

View File

@@ -61,7 +61,7 @@ class OnEnabledComponentTests {
String componentName = "disabled-component";
this.onEnabledComponent = createOnEnabledComponent(componentName);
when(conditionContext.getEnvironment()).thenReturn(environment);
environment.setProperty("spring.cloud.gateway." + componentName + ".enabled", "false");
environment.setProperty("spring.cloud.gateway.server.webflux." + componentName + ".enabled", "false");
ConditionOutcome outcome = onEnabledComponent.getMatchOutcome(conditionContext,
mockMetaData(DisabledComponent.class));

View File

@@ -89,7 +89,8 @@ public class CorsGlobalTests extends BaseWebClientTests {
}
@SpringBootTest(classes = TestConfig.class, properties = "spring.cloud.gateway.globalcors.enabled=false")
@SpringBootTest(classes = TestConfig.class,
properties = "spring.cloud.gateway.server.webflux.globalcors.enabled=false")
public static class DisabledByProperty {
@Autowired(required = false)

View File

@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@SpringBootTest(webEnvironment = RANDOM_PORT,
properties = "spring.cloud.gateway.globalcors.add-to-simple-url-handler-mapping=true")
properties = "spring.cloud.gateway.server.webflux.globalcors.add-to-simple-url-handler-mapping=true")
@DirtiesContext
@ActiveProfiles("request-header-web-filter")
public class SimpleUrlHandlerCorsTests extends BaseWebClientTests {

View File

@@ -38,8 +38,8 @@ import org.springframework.context.annotation.Bean;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(classes = DiscoveryClientRouteDefinitionLocatorIntegrationTests.Config.class,
properties = { "spring.cloud.gateway.discovery.locator.enabled=true",
"spring.cloud.gateway.discovery.locator.route-id-prefix=test__" })
properties = { "spring.cloud.gateway.server.webflux.discovery.locator.enabled=true",
"spring.cloud.gateway.server.webflux.discovery.locator.route-id-prefix=test__" })
public class DiscoveryClientRouteDefinitionLocatorIntegrationTests {
@Autowired

View File

@@ -42,17 +42,17 @@ import static org.springframework.cloud.gateway.filter.factory.RewritePathGatewa
import static org.springframework.cloud.gateway.handler.predicate.RoutePredicateFactory.PATTERN_KEY;
@SpringBootTest(classes = DiscoveryClientRouteDefinitionLocatorTests.Config.class,
properties = { "spring.cloud.gateway.discovery.locator.enabled=true",
"spring.cloud.gateway.discovery.locator.route-id-prefix=testedge_",
"spring.cloud.gateway.discovery.locator.include-expression=metadata['edge'] == 'true'",
"spring.cloud.gateway.discovery.locator.lower-case-service-id=true"
properties = { "spring.cloud.gateway.server.webflux.discovery.locator.enabled=true",
"spring.cloud.gateway.server.webflux.discovery.locator.route-id-prefix=testedge_",
"spring.cloud.gateway.server.webflux.discovery.locator.include-expression=metadata['edge'] == 'true'",
"spring.cloud.gateway.server.webflux.discovery.locator.lower-case-service-id=true"
/*
* "spring.cloud.gateway.discovery.locator.predicates[0].name=Path",
* "spring.cloud.gateway.discovery.locator.predicates[0].args[pattern]='/'+serviceId.toLowerCase(Locale.ROOT)+'/**'",
* "spring.cloud.gateway.discovery.locator.filters[0].name=RewritePath",
* "spring.cloud.gateway.discovery.locator.filters[0].args[regexp]='/' + serviceId.toLowerCase(Locale.ROOT) + '/(?<remaining>.*)'"
* "spring.cloud.gateway.server.webflux.discovery.locator.predicates[0].name=Path",
* "spring.cloud.gateway.server.webflux.discovery.locator.predicates[0].args[pattern]='/'+serviceId.toLowerCase(Locale.ROOT)+'/**'",
* "spring.cloud.gateway.server.webflux.discovery.locator.filters[0].name=RewritePath",
* "spring.cloud.gateway.server.webflux.discovery.locator.filters[0].args[regexp]='/' + serviceId.toLowerCase(Locale.ROOT) + '/(?<remaining>.*)'"
* ,
* "spring.cloud.gateway.discovery.locator.filters[0].args[replacement]='/$\\\\{remaining}'",
* "spring.cloud.gateway.server.webflux.discovery.locator.filters[0].args[replacement]='/$\\\\{remaining}'",
*/
})
public class DiscoveryClientRouteDefinitionLocatorTests {

View File

@@ -35,8 +35,8 @@ public class ReactiveGatewayDiscoveryClientAutoConfigurationTests {
@Nested
@SpringBootTest(classes = Config.class,
properties = { "spring.cloud.gateway.discovery.locator.enabled=true",
"spring.cloud.gateway.loadbalancer.use404=true",
properties = { "spring.cloud.gateway.server.webflux.discovery.locator.enabled=true",
"spring.cloud.gateway.server.webflux.loadbalancer.use404=true",
"spring.cloud.discovery.client.simple.instances.service[0].uri=https://service1:443" })
public class EnabledByProperty {

View File

@@ -109,9 +109,9 @@ class NettyRoutingFilterTests extends BaseWebClientTests {
ConfigurableEnvironment environment = (ConfigurableEnvironment) this.context.getEnvironment();
HashMap<String, Object> map = new HashMap<>();
environment.getPropertySources().addFirst(new MapPropertySource("mock", map));
map.put("spring.cloud.gateway.httpclient.connect-timeout", "1000");
map.put("spring.cloud.gateway.server.webflux.httpclient.connect-timeout", "1000");
this.context.publishEvent(new EnvironmentChangeEvent(this.context,
Collections.singleton("spring.cloud.gateway.httpclient.connect-timeout")));
Collections.singleton("spring.cloud.gateway.server.webflux.httpclient.connect-timeout")));
Route route = routeLocator.getRoutes()
.filter(r -> r.getId().equals("refreshable_configuration_test"))
.blockLast();
@@ -120,9 +120,9 @@ class NettyRoutingFilterTests extends BaseWebClientTests {
HttpClientConfig configuration = httpClient.configuration();
assertThat(configuration.options().get(ChannelOption.CONNECT_TIMEOUT_MILLIS)).isEqualTo(1000);
map.put("spring.cloud.gateway.httpclient.connect-timeout", "5000");
map.put("spring.cloud.gateway.server.webflux.httpclient.connect-timeout", "5000");
this.context.publishEvent(new EnvironmentChangeEvent(this.context,
Collections.singleton("spring.cloud.gateway.httpclient.connect-timeout")));
Collections.singleton("spring.cloud.gateway.server.webflux.httpclient.connect-timeout")));
httpClient = nettyRoutingFilter.getHttpClient(route, null);
configuration = httpClient.configuration();
assertThat(configuration.options().get(ChannelOption.CONNECT_TIMEOUT_MILLIS)).isEqualTo(5000);

View File

@@ -64,8 +64,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@SpringBootTest(webEnvironment = RANDOM_PORT,
properties = { "spring.cloud.gateway.httpclient.connect-timeout=500",
"spring.cloud.gateway.httpclient.response-timeout=2s",
properties = { "spring.cloud.gateway.server.webflux.httpclient.connect-timeout=500",
"spring.cloud.gateway.server.webflux.httpclient.response-timeout=2s",
"logging.level.org.springframework.cloud.gateway.filter.factory.RetryGatewayFilterFactory=TRACE" })
@DirtiesContext
// default filter AddResponseHeader suppresses bug

View File

@@ -69,7 +69,7 @@ public class LocalResponseCacheGatewayFilterFactoryTests extends BaseWebClientTe
}
@Nested
@SpringBootTest(properties = { "spring.cloud.gateway.filter.local-response-cache.enabled=true" },
@SpringBootTest(properties = { "spring.cloud.gateway.server.webflux.filter.local-response-cache.enabled=true" },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class UsingFilterParams extends BaseWebClientTests {
@@ -441,8 +441,8 @@ public class LocalResponseCacheGatewayFilterFactoryTests extends BaseWebClientTe
@Nested
@SpringBootTest(
properties = { "spring.cloud.gateway.filter.local-response-cache.enabled=true",
"spring.cloud.gateway.filter.local-response-cache.timeToLive=20s" },
properties = { "spring.cloud.gateway.server.webflux.filter.local-response-cache.enabled=true",
"spring.cloud.gateway.server.webflux.filter.local-response-cache.timeToLive=20s" },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class UsingPropertiesAsDefault extends BaseWebClientTests {
@@ -550,9 +550,9 @@ public class LocalResponseCacheGatewayFilterFactoryTests extends BaseWebClientTe
}
@Nested
@SpringBootTest(properties = { "spring.cloud.gateway.filter.local-response-cache.enabled=true",
"spring.cloud.gateway.filter.local-response-cache.time-to-live=2m",
"spring.cloud.gateway.filter.local-response-cache.request.no-cache-strategy=skip-update-cache-entry" },
@SpringBootTest(properties = { "spring.cloud.gateway.server.webflux.filter.local-response-cache.enabled=true",
"spring.cloud.gateway.server.webflux.filter.local-response-cache.time-to-live=2m",
"spring.cloud.gateway.server.webflux.filter.local-response-cache.request.no-cache-strategy=skip-update-cache-entry" },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DirectiveNoCacheSkippingUpdate extends BaseWebClientTests {
@@ -656,10 +656,9 @@ public class LocalResponseCacheGatewayFilterFactoryTests extends BaseWebClientTe
}
@Nested
@SpringBootTest(
properties = { "spring.cloud.gateway.filter.local-response-cache.enabled=true",
"spring.cloud.gateway.filter.local-response-cache.time-to-live=2m",
"spring.cloud.gateway.filter.local-response-cache.request.no-cache-strategy=update-cache-entry" },
@SpringBootTest(properties = { "spring.cloud.gateway.server.webflux.filter.local-response-cache.enabled=true",
"spring.cloud.gateway.server.webflux.filter.local-response-cache.time-to-live=2m",
"spring.cloud.gateway.server.webflux.filter.local-response-cache.request.no-cache-strategy=update-cache-entry" },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DirectiveNoCacheWithUpdate extends BaseWebClientTests {

View File

@@ -46,8 +46,8 @@ public class LocalResponseCacheGlobalFilterTests {
@Nested
@SpringBootTest(
properties = { "spring.cloud.gateway.filter.local-response-cache.enabled=true",
"spring.cloud.gateway.global-filter.local-response-cache.enabled=false" },
properties = { "spring.cloud.gateway.server.webflux.filter.local-response-cache.enabled=true",
"spring.cloud.gateway.server.webflux.global-filter.local-response-cache.enabled=false" },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class GlobalCacheNotEnabled extends BaseWebClientTests {
@@ -98,7 +98,7 @@ public class LocalResponseCacheGlobalFilterTests {
}
@Nested
@SpringBootTest(properties = { "spring.cloud.gateway.filter.local-response-cache.enabled=true" },
@SpringBootTest(properties = { "spring.cloud.gateway.server.webflux.filter.local-response-cache.enabled=true" },
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class GlobalCacheEnabled extends BaseWebClientTests {

View File

@@ -60,7 +60,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
* @author fangfeikun
*/
@SpringBootTest(webEnvironment = RANDOM_PORT,
properties = { "spring.cloud.gateway.httpclient.ssl.handshake-timeout=1ms",
properties = { "spring.cloud.gateway.server.webflux.httpclient.ssl.handshake-timeout=1ms",
"spring.main.allow-bean-definition-overriding=true" })
@DirtiesContext
@ActiveProfiles("single-cert-ssl")

View File

@@ -43,7 +43,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
/**
* @author Spencer Gibb
*/
@SpringBootTest(webEnvironment = RANDOM_PORT, properties = "spring.cloud.gateway.redis.enabled=false")
@SpringBootTest(webEnvironment = RANDOM_PORT, properties = "spring.cloud.gateway.server.webflux.redis.enabled=false")
@DirtiesContext
public class Bucket4jRateLimiterTests extends BaseWebClientTests {

View File

@@ -54,7 +54,8 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
* @author Denis Cutic
* @author Andrey Muchnik
*/
@SpringBootTest(webEnvironment = RANDOM_PORT, properties = { "spring.cloud.gateway.function.enabled=false" })
@SpringBootTest(webEnvironment = RANDOM_PORT,
properties = { "spring.cloud.gateway.server.webflux.function.enabled=false" })
@DirtiesContext
@Testcontainers
@Tag("DockerRequired")

View File

@@ -42,9 +42,9 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@SpringBootTest(webEnvironment = RANDOM_PORT,
properties = { "spring.cloud.gateway.route-filter-cache-enabled=true",
properties = { "spring.cloud.gateway.server.webflux.route-filter-cache-enabled=true",
"management.endpoint.gateway.enabled=true", "management.endpoints.web.exposure.include=*",
"spring.cloud.gateway.actuator.verbose.enabled=true" })
"spring.cloud.gateway.server.webflux.actuator.verbose.enabled=true" })
@DirtiesContext
public class FilteringWebHandlerCacheEnabledIntegrationTests extends BaseWebClientTests {

View File

@@ -34,7 +34,7 @@ import org.springframework.expression.spel.standard.SpelExpressionParser;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(properties = "spring.cloud.gateway.restrictive-property-accessor.enabled=false")
@SpringBootTest(properties = "spring.cloud.gateway.server.webflux.restrictive-property-accessor.enabled=false")
public class ShortcutConfigurableNonRestrictiveTests {
@Autowired

View File

@@ -37,8 +37,8 @@ public class PropertiesTagsProviderTests {
@Test
public void test() {
contextRunner.withConfiguration(AutoConfigurations.of(GatewayMetricsAutoConfiguration.class))
.withPropertyValues("spring.cloud.gateway.metrics.tags.foo1=bar1",
"spring.cloud.gateway.metrics.tags.foo2=bar2")
.withPropertyValues("spring.cloud.gateway.server.webflux.metrics.tags.foo1=bar1",
"spring.cloud.gateway.server.webflux.metrics.tags.foo2=bar2")
.run(context -> {
PropertiesTagsProvider provider = context.getBean(PropertiesTagsProvider.class);
Tags tags = provider.apply(MockServerWebExchange.from(MockServerHttpRequest.get("").build()));

View File

@@ -62,7 +62,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
import static org.springframework.cloud.gateway.test.TestUtils.getMap;
@SpringBootTest(webEnvironment = RANDOM_PORT, properties = "spring.cloud.gateway.forwarded.by.enabled=true")
@SpringBootTest(webEnvironment = RANDOM_PORT,
properties = "spring.cloud.gateway.server.webflux.forwarded.by.enabled=true")
@DirtiesContext
@SuppressWarnings("unchecked")
@ExtendWith(OutputCaptureExtension.class)

View File

@@ -44,13 +44,13 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
@ActiveProfiles("client-auth-ssl")
public class ClientCertAuthSSLTests extends SingleCertSSLTests {
@Value("${spring.cloud.gateway.httpclient.ssl.key-store}")
@Value("${spring.cloud.gateway.server.webflux.httpclient.ssl.key-store}")
private String keyStore;
@Value("${spring.cloud.gateway.httpclient.ssl.key-store-password}")
@Value("${spring.cloud.gateway.server.webflux.httpclient.ssl.key-store-password}")
private String keyStorePassword;
@Value("${spring.cloud.gateway.httpclient.ssl.key-password}")
@Value("${spring.cloud.gateway.server.webflux.httpclient.ssl.key-password}")
private String keyPassword;
@BeforeEach

View File

@@ -29,7 +29,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
// this test works because it assumes TLS hand shake cannot be done in 1ms. It takes
// closer to 80ms
@SpringBootTest(webEnvironment = RANDOM_PORT,
properties = { "spring.cloud.gateway.httpclient.ssl.handshake-timeout=1ms" })
properties = { "spring.cloud.gateway.server.webflux.httpclient.ssl.handshake-timeout=1ms" })
@DirtiesContext
@ActiveProfiles("ssl")
public class SSLHandshakeTimeoutTests extends SingleCertSSLTests {

View File

@@ -15,7 +15,7 @@ server:
client-auth: Need
spring:
cloud:
gateway:
gateway.server.webflux:
httpclient:
ssl:
ssl-bundle: scg-keystore-with-different-key-password

View File

@@ -15,7 +15,7 @@ server:
client-auth: Need
spring:
cloud:
gateway:
gateway.server.webflux:
httpclient:
ssl:
key-store: classpath:scg-keystore-with-different-key-password.jks

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
globalcors:
cors-configurations:
'[/**]':

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
routes:
- id: cors_preflight_test
uri: ${test.uri}

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
default-filters:
- PrefixPath=/httpbin
routes:

View File

@@ -7,7 +7,7 @@ spring:
import: classpath:application-logging.yml
cloud:
gateway:
gateway.server.webflux:
globalcors:
cors-configurations:
'[/**]':

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
routes:
- uri: forward:/docs.html
id: static_docs_route

View File

@@ -11,7 +11,7 @@ server:
spring:
cloud:
gateway:
gateway.server.webflux:
httpclient:
ssl:
trustedX509Certificates:

View File

@@ -14,7 +14,7 @@ spring:
- logging
cloud:
gateway:
gateway.server.webflux:
routes:
# =====================================
- id: per_route_connect_timeout

View File

@@ -0,0 +1,32 @@
spring.cloud.gateway:
route-refresh-listener.enabled: false
forwarded.enabled: false
x-forwarded.enabled: false
predicate.after.enabled: false
filter.add-request-parameter.enabled: false
routes:
- id: listRoute1
uri: https://examplel1.com
predicates:
- name: Method
args:
methods: GET
- name: Path
args:
pattern: /anything/listRoute1
filters:
- AddRequestHeader=X-Test,listRoute1
- id: listRoute2
uri: https://examplel2.com
predicates:
- name: Method
args:
methods: GET
- name: Path
args:
pattern: /anything/listRoute2
filters:
- AddRequestHeader=X-Test,listRoute2
logging:
level:
org.springframework.cloud.gateway: TRACE

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
default-filters:
routes:
# =====================================

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
default-filters:
- name: RequestRateLimiter
args:

View File

@@ -1,5 +1,5 @@
spring:
cloud:
gateway:
gateway.server.webflux:
redis-route-definition-repository:
enabled: true

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
default-filters:
routes:
# =====================================

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
default-filters:
- RemoveNonProxyHeaders
- PrefixPath=/httpbin

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
routes:
- id: add_request_header_test
uri: ${test.uri}

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
routes:
- id: add_request_headers_if_not_present_test
uri: ${test.uri}

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
routes:
- id: map_request_header_test_singleresponse
uri: ${test.uri}

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
routes:
- id: add_request_parameter_test
uri: ${test.uri}

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
default-filters:
- PrefixPath=/httpbin
routes:

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
routes:
- id: save_session_test
uri: ${test.uri}

View File

@@ -11,7 +11,7 @@ server:
spring:
cloud:
gateway:
gateway.server.webflux:
httpclient:
ssl:
trustedX509Certificates:

View File

@@ -1,7 +1,7 @@
server.port: 0
spring:
cloud:
gateway:
gateway.server.webflux:
routes:
- uri: https://example.com
predicates:

View File

@@ -1,6 +1,6 @@
spring:
cloud:
gateway:
gateway.server.webflux:
default-filters:
- PrefixPath=/httpbin
routes:

View File

@@ -14,7 +14,7 @@ spring:
- logging
cloud:
gateway:
gateway.server.webflux:
globalcors:
cors-configurations:
'[/**]':