|
|
@ -19,6 +19,9 @@ package org.springframework.boot.autoconfigure.rsocket;
|
|
|
|
import io.rsocket.RSocketFactory;
|
|
|
|
import io.rsocket.RSocketFactory;
|
|
|
|
import io.rsocket.transport.netty.server.TcpServerTransport;
|
|
|
|
import io.rsocket.transport.netty.server.TcpServerTransport;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.ObjectProvider;
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
|
@ -28,6 +31,7 @@ import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.messaging.rsocket.RSocketRequester;
|
|
|
|
import org.springframework.messaging.rsocket.RSocketRequester;
|
|
|
|
import org.springframework.messaging.rsocket.RSocketStrategies;
|
|
|
|
import org.springframework.messaging.rsocket.RSocketStrategies;
|
|
|
|
import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler;
|
|
|
|
import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler;
|
|
|
|
|
|
|
|
import org.springframework.util.RouteMatcher;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* {@link EnableAutoConfiguration Auto-configuration} for Spring RSocket support in Spring
|
|
|
|
* {@link EnableAutoConfiguration Auto-configuration} for Spring RSocket support in Spring
|
|
|
@ -37,16 +41,20 @@ import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHa
|
|
|
|
* @since 2.2.0
|
|
|
|
* @since 2.2.0
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@ConditionalOnClass({ RSocketRequester.class, RSocketFactory.class, TcpServerTransport.class })
|
|
|
|
@ConditionalOnClass({RSocketRequester.class, RSocketFactory.class, TcpServerTransport.class})
|
|
|
|
@AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class)
|
|
|
|
@AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class)
|
|
|
|
public class RSocketMessagingAutoConfiguration {
|
|
|
|
public class RSocketMessagingAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
public RSocketMessageHandler messageHandler(RSocketStrategies rSocketStrategies) {
|
|
|
|
public RSocketMessageHandler messageHandler(RSocketStrategies rSocketStrategies, ObjectProvider<RSocketMessageHandlerCustomizer> customizers) {
|
|
|
|
RSocketMessageHandler messageHandler = new RSocketMessageHandler();
|
|
|
|
RSocketMessageHandler messageHandler = new RSocketMessageHandler();
|
|
|
|
messageHandler.setRSocketStrategies(rSocketStrategies);
|
|
|
|
messageHandler.setRSocketStrategies(rSocketStrategies);
|
|
|
|
return messageHandler;
|
|
|
|
RSocketMessageHandlerCustomizer rSocketMessageHandlerCustomizer = customizers.getIfAvailable();
|
|
|
|
|
|
|
|
return rSocketMessageHandlerCustomizer.setRouteMatcher(rSocketStrategies.routeMatcher());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|