Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
456d6e78
Commit
456d6e78
authored
Apr 17, 2020
by
Aarti Gupta
Committed by
Madhura Bhave
Apr 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for customizing RSocketMessageHandler
See gh-21081
parent
0cb09076
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
RSocketMessageHandlerCustomizer.java
...utoconfigure/rsocket/RSocketMessageHandlerCustomizer.java
+18
-0
RSocketMessagingAutoConfiguration.java
...oconfigure/rsocket/RSocketMessagingAutoConfiguration.java
+11
-3
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketMessageHandlerCustomizer.java
0 → 100644
View file @
456d6e78
package
org
.
springframework
.
boot
.
autoconfigure
.
rsocket
;
import
org.apache.catalina.connector.Connector
;
import
org.springframework.boot.web.embedded.tomcat.ConfigurableTomcatWebServerFactory
;
import
org.springframework.messaging.rsocket.RSocketStrategies
;
import
org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler
;
import
org.springframework.util.RouteMatcher
;
/**
* @author Aarti Gupta
* Callback interface that can be used to customize a RSocketMessageHandler {@link Connector}.
*/
@FunctionalInterface
public
interface
RSocketMessageHandlerCustomizer
{
RSocketMessageHandler
setRouteMatcher
(
RouteMatcher
handler
);
}
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketMessagingAutoConfiguration.java
View file @
456d6e78
...
...
@@ -19,6 +19,9 @@ package org.springframework.boot.autoconfigure.rsocket;
import
io.rsocket.RSocketFactory
;
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.EnableAutoConfiguration
;
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.RSocketStrategies
;
import
org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler
;
import
org.springframework.util.RouteMatcher
;
/**
* {@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
*/
@Configuration
(
proxyBeanMethods
=
false
)
@ConditionalOnClass
({
RSocketRequester
.
class
,
RSocketFactory
.
class
,
TcpServerTransport
.
class
})
@ConditionalOnClass
({
RSocketRequester
.
class
,
RSocketFactory
.
class
,
TcpServerTransport
.
class
})
@AutoConfigureAfter
(
RSocketStrategiesAutoConfiguration
.
class
)
public
class
RSocketMessagingAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
public
RSocketMessageHandler
messageHandler
(
RSocketStrategies
rSocketStrategies
)
{
public
RSocketMessageHandler
messageHandler
(
RSocketStrategies
rSocketStrategies
,
ObjectProvider
<
RSocketMessageHandlerCustomizer
>
customizers
)
{
RSocketMessageHandler
messageHandler
=
new
RSocketMessageHandler
();
messageHandler
.
setRSocketStrategies
(
rSocketStrategies
);
return
messageHandler
;
RSocketMessageHandlerCustomizer
rSocketMessageHandlerCustomizer
=
customizers
.
getIfAvailable
();
return
rSocketMessageHandlerCustomizer
.
setRouteMatcher
(
rSocketStrategies
.
routeMatcher
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment