Skip to content

Commit 9e1ff4e

Browse files
committed
Fix chapter 10's Spring Cloud Gateway configuration
1 parent cd1f050 commit 9e1ff4e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

10/part1/chat/src/main/java/com/greglturnquist/learningspringboot/chat/GatewayConfig.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717

1818
import org.slf4j.Logger;
1919
import org.slf4j.LoggerFactory;
20-
21-
import org.springframework.cloud.gateway.filter.factory.WebFilterFactory;
20+
import org.springframework.cloud.gateway.filter.GatewayFilter;
21+
import org.springframework.cloud.gateway.filter.factory.GatewayFilterFactory;
2222
import org.springframework.context.annotation.Bean;
2323
import org.springframework.context.annotation.Configuration;
2424
import org.springframework.tuple.Tuple;
25-
import org.springframework.web.server.WebFilter;
2625
import org.springframework.web.server.WebSession;
2726

2827
/**
@@ -38,10 +37,10 @@ public class GatewayConfig {
3837
/**
3938
* Force the current WebSession to get saved
4039
*/
41-
static class SaveSessionWebFilterFactory
42-
implements WebFilterFactory {
40+
static class SaveSessionGatewayFilterFactory
41+
implements GatewayFilterFactory {
4342
@Override
44-
public WebFilter apply(Tuple args) {
43+
public GatewayFilter apply(Tuple args) {
4544
return (exchange, chain) -> exchange.getSession()
4645
.map(webSession -> {
4746
log.debug("Session id: " + webSession.getId());
@@ -57,8 +56,8 @@ public WebFilter apply(Tuple args) {
5756
}
5857

5958
@Bean
60-
SaveSessionWebFilterFactory saveSessionWebFilterFactory() {
61-
return new SaveSessionWebFilterFactory();
59+
SaveSessionGatewayFilterFactory saveSessionWebFilterFactory() {
60+
return new SaveSessionGatewayFilterFactory();
6261
}
6362
}
6463
// end::code[]

0 commit comments

Comments
 (0)