Skip to content

Commit cf8c1eb

Browse files
authored
Merge branch 'spring-cloud:main' into setrequesturi
2 parents f5076c4 + ec60c2e commit cf8c1eb

File tree

173 files changed

+5848
-986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+5848
-986
lines changed

docs/modules/ROOT/pages/spring-cloud-gateway-server-webflux/gatewayfilter-factories/secureheaders-factory.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The following headers (shown with their default values) are added:
1010
* `X-Frame-Options (DENY)`
1111
* `X-Content-Type-Options (nosniff)`
1212
* `Referrer-Policy (no-referrer)`
13-
* `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)'`
13+
* `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')`
1414
* `X-Download-Options (noopen)`
1515
* `X-Permitted-Cross-Domain-Policies (none)`
1616

docs/modules/ROOT/pages/spring-cloud-gateway-server-webflux/request-predicates-factories.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ This route matches if the request path was, for example: `/red/1` or `/red/1/` o
192192

193193
If `matchTrailingSlash` is set to `false`, then request path `/red/1/` will not be matched.
194194

195+
If you have set `spring.webflux.base-path` property, this will influence the path matching. The property value will be automatically prepended to the path patterns. For example, with `spring.webflux.base-path=/app` and a path pattern of `/red/\{segment\}`, the full pattern used for matching would be `/app/red/\{segment\}`.
196+
195197
This predicate extracts the URI template variables (such as `segment`, defined in the preceding example) as a map of names and values and places it in the `ServerWebExchange.getAttributes()` with a key defined in `ServerWebExchangeUtils.URI_TEMPLATE_VARIABLES_ATTRIBUTE`.
196198
Those values are then available for use by <<gateway-route-filters,`GatewayFilter` factories>>
197199

docs/modules/ROOT/pages/spring-cloud-gateway-server-webmvc/writing-custom-predicates-and-filters.adoc

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,21 +240,19 @@ The above route will add a `X-Response-Id` header to the response. Note the use
240240

241241
== How To Register Custom Predicates and Filters for Configuration
242242

243-
To use custom Predicates and Filters in external configuration you need to create a special Supplier class and register it in `META-INF/spring.factories`.
243+
To use custom Predicates and Filters in external configuration you need to create a special Supplier class and register it a bean in the application context.
244244

245245
=== Registering Custom Predicates
246246

247247
To register custom predicates you need to implement `PredicateSupplier`. The `PredicateDiscoverer` looks for static methods that return `RequestPredicates` to register.
248248

249-
250249
SampleFilterSupplier.java
251250
[source,java]
252251
----
253252
package com.example;
254253
255254
import org.springframework.cloud.gateway.server.mvc.predicate.PredicateSupplier;
256255
257-
@Configuration
258256
class SamplePredicateSupplier implements PredicateSupplier {
259257
260258
@Override
@@ -265,7 +263,24 @@ class SamplePredicateSupplier implements PredicateSupplier {
265263
}
266264
----
267265

268-
You then need to add the class in `META-INF/spring.factories`.
266+
To register the `PredicateSupplier` for use in config files, you then need to add the class as a bean as in the example below:
267+
268+
.PredicateConfiguration.java
269+
[source,java]
270+
----
271+
package com.example;
272+
273+
@Configuration
274+
class PredicateConfiguration {
275+
276+
@Bean
277+
public SamplePredicateSupplier samplePredicateSupplier() {
278+
return new SamplePredicateSupplier();
279+
}
280+
}
281+
----
282+
283+
The requirement to add the class to `META-INF/spring.factories` is deprecated and will be removed in the next major release.
269284

270285
.META-INF/spring.factories
271286
[source]
@@ -285,7 +300,6 @@ package com.example;
285300
286301
import org.springframework.cloud.gateway.server.mvc.filter.SimpleFilterSupplier;
287302
288-
@Configuration
289303
class SampleFilterSupplier extends SimpleFilterSupplier {
290304
291305
public SampleFilterSupplier() {
@@ -294,7 +308,24 @@ class SampleFilterSupplier extends SimpleFilterSupplier {
294308
}
295309
----
296310

297-
You then need to add the class in `META-INF/spring.factories`.
311+
To register the `FilterSupplier` for use in config files, you then need to add the class as a bean as in the example below:
312+
313+
.FilterConfiguration.java
314+
[source,java]
315+
----
316+
package com.example;
317+
318+
@Configuration
319+
class FilterConfiguration {
320+
321+
@Bean
322+
public SampleFilterSupplier sampleFilterSupplier() {
323+
return new SampleFilterSupplier();
324+
}
325+
}
326+
----
327+
328+
The requirement to add the class to `META-INF/spring.factories` is deprecated and will be removed in the next major release.
298329

299330
.META-INF/spring.factories
300331
[source]

docs/modules/ROOT/partials/_configprops.adoc

Lines changed: 211 additions & 2 deletions
Large diffs are not rendered by default.

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"@antora/collector-extension": "1.0.1",
66
"@asciidoctor/tabs": "1.0.0-beta.6",
77
"@springio/antora-extensions": "1.14.4",
8-
"@springio/asciidoctor-extensions": "1.0.0-alpha.16"
8+
"@springio/asciidoctor-extensions": "1.0.0-alpha.17"
99
}
1010
}

spring-cloud-gateway-integration-tests/grpc/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<properties>
1414
<protoc.version>3.25.1</protoc.version>
15-
<grpc.version>1.71.0</grpc.version>
15+
<grpc.version>1.72.0</grpc.version>
1616
</properties>
1717

1818
<parent>

spring-cloud-gateway-integration-tests/grpc/src/test/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ management:
2020

2121
spring:
2222
cloud:
23-
gateway:
23+
gateway.server.webflux:
2424
httpserver:
2525
wiretap: true
2626
httpclient:

spring-cloud-gateway-integration-tests/http2/src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ server:
1313

1414
spring:
1515
cloud:
16-
gateway:
16+
gateway.server.webflux:
1717
# httpserver:
1818
# wiretap: true
1919
httpclient:

spring-cloud-gateway-integration-tests/http2/src/test/resources/application-nossl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ server:
99

1010
spring:
1111
cloud:
12-
gateway:
12+
gateway.server.webflux:
1313
enabled: false
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<artifactId>httpclient</artifactId>
8+
<packaging>jar</packaging>
9+
10+
<name>Spring Cloud Gateway HttpClient Integration Test</name>
11+
<description>Spring Cloud Gateway HttpClient Integration Test</description>
12+
13+
<properties>
14+
</properties>
15+
16+
<parent>
17+
<groupId>org.springframework.cloud</groupId>
18+
<artifactId>spring-cloud-gateway-integration-tests</artifactId>
19+
<version>4.3.0-SNAPSHOT</version>
20+
<relativePath>..</relativePath> <!-- lookup parent from repository -->
21+
</parent>
22+
23+
24+
<dependencies>
25+
<dependency>
26+
<groupId>org.springframework.boot</groupId>
27+
<artifactId>spring-boot-starter-web</artifactId>
28+
</dependency>
29+
30+
<dependency>
31+
<groupId>org.springframework.boot</groupId>
32+
<artifactId>spring-boot-starter-webflux</artifactId>
33+
</dependency>
34+
35+
<dependency>
36+
<groupId>org.springframework.cloud</groupId>
37+
<artifactId>spring-cloud-starter-gateway-mvc</artifactId>
38+
</dependency>
39+
40+
<dependency>
41+
<groupId>org.springframework.retry</groupId>
42+
<artifactId>spring-retry</artifactId>
43+
</dependency>
44+
45+
<dependency>
46+
<groupId>org.springframework.cloud</groupId>
47+
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
48+
</dependency>
49+
50+
<dependency>
51+
<groupId>org.apache.httpcomponents.client5</groupId>
52+
<artifactId>httpclient5</artifactId>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>org.springframework.boot</groupId>
57+
<artifactId>spring-boot-starter-test</artifactId>
58+
<scope>test</scope>
59+
</dependency>
60+
<dependency>
61+
<groupId>org.assertj</groupId>
62+
<artifactId>assertj-core</artifactId>
63+
<scope>test</scope>
64+
</dependency>
65+
</dependencies>
66+
67+
<build>
68+
<plugins>
69+
<plugin>
70+
<artifactId>maven-deploy-plugin</artifactId>
71+
<configuration>
72+
<skip>true</skip>
73+
</configuration>
74+
</plugin>
75+
</plugins>
76+
</build>
77+
</project>

0 commit comments

Comments
 (0)