|
19 | 19 | import io.rsocket.RSocketFactory;
|
20 | 20 | import io.rsocket.transport.netty.server.TcpServerTransport;
|
21 | 21 |
|
| 22 | +import java.util.Objects; |
| 23 | +import java.util.stream.Collectors; |
| 24 | +import org.springframework.beans.factory.ObjectProvider; |
22 | 25 | import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
23 | 26 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
24 | 27 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
28 | 31 | import org.springframework.messaging.rsocket.RSocketRequester;
|
29 | 32 | import org.springframework.messaging.rsocket.RSocketStrategies;
|
30 | 33 | import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler;
|
| 34 | +import org.springframework.util.RouteMatcher; |
31 | 35 |
|
32 | 36 | /**
|
33 | 37 | * {@link EnableAutoConfiguration Auto-configuration} for Spring RSocket support in Spring
|
|
37 | 41 | * @since 2.2.0
|
38 | 42 | */
|
39 | 43 | @Configuration(proxyBeanMethods = false)
|
40 |
| -@ConditionalOnClass({ RSocketRequester.class, RSocketFactory.class, TcpServerTransport.class }) |
| 44 | +@ConditionalOnClass({RSocketRequester.class, RSocketFactory.class, TcpServerTransport.class}) |
41 | 45 | @AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class)
|
42 | 46 | public class RSocketMessagingAutoConfiguration {
|
43 | 47 |
|
| 48 | + |
44 | 49 | @Bean
|
45 | 50 | @ConditionalOnMissingBean
|
46 |
| - public RSocketMessageHandler messageHandler(RSocketStrategies rSocketStrategies) { |
| 51 | + public RSocketMessageHandler messageHandler(RSocketStrategies rSocketStrategies, ObjectProvider<RSocketMessageHandlerCustomizer> customizers) { |
47 | 52 | RSocketMessageHandler messageHandler = new RSocketMessageHandler();
|
48 | 53 | messageHandler.setRSocketStrategies(rSocketStrategies);
|
49 |
| - return messageHandler; |
| 54 | + RSocketMessageHandlerCustomizer rSocketMessageHandlerCustomizer = customizers.getIfAvailable(); |
| 55 | + return rSocketMessageHandlerCustomizer.setRouteMatcher(rSocketStrategies.routeMatcher()); |
50 | 56 | }
|
51 | 57 |
|
| 58 | + |
| 59 | + |
52 | 60 | }
|
0 commit comments