-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Description
Used Spring Versions
Used Spring Boot Version: 2.2.0.BUILD-SNAPSHOT
Used Spring Version: 5.2
User Spring Cloud Version: Hoxton.M2
Sample Project: https://github.com/FWinkler79/SpringCloudPlatform/tree/Issue-SpringBootRsocketAutoconfig
What's the issue?
RSocketWebSocketNettyRouteProvider is package protected and is declared in RSocketServerAutoConfiguration#WebFluxServerAutoConfiguration as an overridable bean named rSocketWebsocketRouteProvider.
I would like to override that bean, since for now this is the only reasonable way to configure the ServerRSocketFactory to add things like lease handling. See this stackoverflow question which describes the reason why I need to do it like that currently.
In order to override the rSocketWebsocketRouteProvider bean, I either need to place my bean configuration in the same package as RSocketWebSocketNettyRouteProvider (which then might cause all kinds of component scan issues) or I need to create a subclass of it, in the same package (which is my current solution).
Generally, it is tedious having to do so, and could be avoided, if the RSocketWebSocketNettyRouteProvider were a public class.
Expected Solution
- Make
RSocketWebSocketNettyRouteProviderpublic. - Make it possible for an application to define an arbitrary number of
@OrderedServerRSocketFactoryCustomizerbeans that will be picked up to modify the auto-configuredServerRSocketFactory(as described on stack overflow) - Consider exposing
ServerRSocketFactory(created inRSocketWebSocketNettyRouteProvider#apply(...)) as a bean. That would allow applications to easily add additional configurations to it.
Sample Project
You can find a sample project that shows the current solution here.
To get it started, proceed as follows:
- start Zipkin (using
scripts/startZipkin.sh - start RabbitMQ (using
scripts/startRabbit.sh - start
service-registry - start
config-server - start
rsocket-server - start
rsocket-client
Notice class CustomRSocketWebSocketNettyRouteProvider in rsocket-server which is a subclass of RSocketWebSocketNettyRouteProvider and that it needs to be declared in a Spring Boot auto-config package.