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
985c8f75
Commit
985c8f75
authored
Jun 13, 2019
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish RSocket support
parent
704b5fb2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
28 additions
and
48 deletions
+28
-48
RSocketMessagingAutoConfiguration.java
...oconfigure/rsocket/RSocketMessagingAutoConfiguration.java
+1
-1
RSocketProperties.java
...amework/boot/autoconfigure/rsocket/RSocketProperties.java
+1
-1
RSocketRequesterAutoConfiguration.java
...oconfigure/rsocket/RSocketRequesterAutoConfiguration.java
+1
-1
RSocketServerAutoConfiguration.java
...autoconfigure/rsocket/RSocketServerAutoConfiguration.java
+2
-2
RSocketStrategiesAutoConfiguration.java
...configure/rsocket/RSocketStrategiesAutoConfiguration.java
+2
-2
RSocketMessagingAutoConfigurationTests.java
...igure/rsocket/RSocketMessagingAutoConfigurationTests.java
+3
-3
RSocketRequesterAutoConfigurationTests.java
...igure/rsocket/RSocketRequesterAutoConfigurationTests.java
+1
-1
RSocketServerAutoConfigurationTests.java
...onfigure/rsocket/RSocketServerAutoConfigurationTests.java
+12
-15
RSocketStrategiesAutoConfigurationTests.java
...gure/rsocket/RSocketStrategiesAutoConfigurationTests.java
+5
-22
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketMessagingAutoConfiguration.java
View file @
985c8f75
...
...
@@ -44,7 +44,7 @@ import org.springframework.web.util.pattern.PathPatternRouteMatcher;
@AutoConfigureAfter
(
RSocketStrategiesAutoConfiguration
.
class
)
public
class
RSocketMessagingAutoConfiguration
{
private
static
String
PATHPATTERN_ROUTEMATCHER_CLASS
=
"org.springframework.web.util.pattern.PathPatternRouteMatcher"
;
private
static
final
String
PATHPATTERN_ROUTEMATCHER_CLASS
=
"org.springframework.web.util.pattern.PathPatternRouteMatcher"
;
@Bean
@ConditionalOnMissingBean
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketProperties.java
View file @
985c8f75
...
...
@@ -35,7 +35,7 @@ public class RSocketProperties {
return
this
.
server
;
}
static
class
Server
{
public
static
class
Server
{
/**
* Server port.
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketRequesterAutoConfiguration.java
View file @
985c8f75
...
...
@@ -48,7 +48,7 @@ public class RSocketRequesterAutoConfiguration {
@Bean
@Scope
(
"prototype"
)
@ConditionalOnMissingBean
public
RSocketRequester
.
Builder
r
s
ocketRequesterBuilder
(
RSocketStrategies
strategies
)
{
public
RSocketRequester
.
Builder
r
S
ocketRequesterBuilder
(
RSocketStrategies
strategies
)
{
return
RSocketRequester
.
builder
().
rsocketStrategies
(
strategies
);
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java
View file @
985c8f75
...
...
@@ -81,7 +81,7 @@ public class RSocketServerAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public
ReactorResourceFactory
reactor
Server
ResourceFactory
()
{
public
ReactorResourceFactory
reactorResourceFactory
()
{
return
new
ReactorResourceFactory
();
}
...
...
@@ -109,7 +109,7 @@ public class RSocketServerAutoConfiguration {
static
class
OnRSocketWebServerCondition
extends
AllNestedConditions
{
OnRSocketWebServerCondition
()
{
super
(
ConfigurationPhase
.
REGISTER_BEA
N
);
super
(
ConfigurationPhase
.
PARSE_CONFIGURATIO
N
);
}
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
REACTIVE
)
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfiguration.java
View file @
985c8f75
...
...
@@ -76,7 +76,7 @@ public class RSocketStrategiesAutoConfiguration {
@Bean
@Order
(
0
)
@ConditionalOnBean
(
Jackson2ObjectMapperBuilder
.
class
)
public
RSocketStrategiesCustomizer
jacksonCborStrategyCustomizer
(
Jackson2ObjectMapperBuilder
builder
)
{
public
RSocketStrategiesCustomizer
jacksonCbor
RSocket
StrategyCustomizer
(
Jackson2ObjectMapperBuilder
builder
)
{
return
(
strategy
)
->
{
ObjectMapper
objectMapper
=
builder
.
factory
(
new
CBORFactory
()).
build
();
strategy
.
decoder
(
new
Jackson2CborDecoder
(
objectMapper
,
SUPPORTED_TYPES
));
...
...
@@ -96,7 +96,7 @@ public class RSocketStrategiesAutoConfiguration {
@Bean
@Order
(
1
)
@ConditionalOnBean
(
ObjectMapper
.
class
)
public
RSocketStrategiesCustomizer
jacksonJsonStrategyCustomizer
(
ObjectMapper
objectMapper
)
{
public
RSocketStrategiesCustomizer
jacksonJson
RSocket
StrategyCustomizer
(
ObjectMapper
objectMapper
)
{
return
(
strategy
)
->
{
strategy
.
decoder
(
new
Jackson2JsonDecoder
(
objectMapper
,
SUPPORTED_TYPES
));
strategy
.
encoder
(
new
Jackson2JsonEncoder
(
objectMapper
,
SUPPORTED_TYPES
));
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketMessagingAutoConfigurationTests.java
View file @
985c8f75
...
...
@@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
class
RSocketMessagingAutoConfigurationTests
{
private
ApplicationContextRunner
contextRunner
=
new
ApplicationContextRunner
()
private
final
ApplicationContextRunner
contextRunner
=
new
ApplicationContextRunner
()
.
withConfiguration
(
AutoConfigurations
.
of
(
RSocketMessagingAutoConfiguration
.
class
))
.
withUserConfiguration
(
BaseConfiguration
.
class
);
...
...
@@ -67,7 +67,7 @@ class RSocketMessagingAutoConfigurationTests {
.
containsOnly
(
"customMessageHandlerAcceptor"
));
}
@Configuration
@Configuration
(
proxyBeanMethods
=
false
)
static
class
BaseConfiguration
{
@Bean
...
...
@@ -78,7 +78,7 @@ class RSocketMessagingAutoConfigurationTests {
}
@Configuration
@Configuration
(
proxyBeanMethods
=
false
)
static
class
CustomMessageHandlerAcceptor
{
@Bean
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketRequesterAutoConfigurationTests.java
View file @
985c8f75
...
...
@@ -34,7 +34,7 @@ import static org.mockito.Mockito.mock;
*/
class
RSocketRequesterAutoConfigurationTests
{
private
ApplicationContextRunner
contextRunner
=
new
ApplicationContextRunner
().
withConfiguration
(
private
final
ApplicationContextRunner
contextRunner
=
new
ApplicationContextRunner
().
withConfiguration
(
AutoConfigurations
.
of
(
RSocketStrategiesAutoConfiguration
.
class
,
RSocketRequesterAutoConfiguration
.
class
));
@Test
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfigurationTests.java
View file @
985c8f75
...
...
@@ -42,22 +42,20 @@ class RSocketServerAutoConfigurationTests {
@Test
void
shouldNotCreateBeansByDefault
()
{
ApplicationContextRunner
contextRunner
=
createContextRunner
();
contextRunner
.
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
WebServerFactoryCustomizer
.
class
)
contextRunner
().
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
WebServerFactoryCustomizer
.
class
)
.
doesNotHaveBean
(
RSocketServerFactory
.
class
).
doesNotHaveBean
(
RSocketServerBootstrap
.
class
));
}
@Test
void
shouldNotCreateDefaultBeansForReactiveWebAppWithoutMapping
()
{
ReactiveWebApplicationContextRunner
contextRunner
=
createReactiveWebContextRunner
();
contextRunner
.
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
WebServerFactoryCustomizer
.
class
)
.
doesNotHaveBean
(
RSocketServerFactory
.
class
).
doesNotHaveBean
(
RSocketServerBootstrap
.
class
));
reactiveWebContextRunner
()
.
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
WebServerFactoryCustomizer
.
class
)
.
doesNotHaveBean
(
RSocketServerFactory
.
class
).
doesNotHaveBean
(
RSocketServerBootstrap
.
class
));
}
@Test
void
shouldNotCreateDefaultBeansForReactiveWebAppWithWrongTransport
()
{
ReactiveWebApplicationContextRunner
contextRunner
=
createReactiveWebContextRunner
();
contextRunner
reactiveWebContextRunner
()
.
withPropertyValues
(
"spring.rsocket.server.transport=tcp"
,
"spring.rsocket.server.mapping-path=/rsocket"
)
.
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
WebServerFactoryCustomizer
.
class
)
...
...
@@ -66,8 +64,7 @@ class RSocketServerAutoConfigurationTests {
@Test
void
shouldCreateDefaultBeansForReactiveWebApp
()
{
ReactiveWebApplicationContextRunner
contextRunner
=
createReactiveWebContextRunner
();
contextRunner
reactiveWebContextRunner
()
.
withPropertyValues
(
"spring.rsocket.server.transport=websocket"
,
"spring.rsocket.server.mapping-path=/rsocket"
)
.
run
((
context
)
->
assertThat
(
context
).
hasSingleBean
(
RSocketWebSocketNettyRouteProvider
.
class
));
...
...
@@ -75,22 +72,22 @@ class RSocketServerAutoConfigurationTests {
@Test
void
shouldCreateDefaultBeansForRSocketServerWhenPortIsSet
()
{
ReactiveWebApplicationContextRunner
contextRunner
=
createReactiveWebContextRunner
();
contextRunner
.
withPropertyValues
(
"spring.rsocket.server.port=0"
).
run
((
context
)
->
assertThat
(
context
)
.
hasSingleBean
(
RSocketServerFactory
.
class
)
.
hasSingleBean
(
RSocketServerBootstrap
.
class
));
reactiveWebContextRunner
().
withPropertyValues
(
"spring.rsocket.server.port=0"
)
.
run
((
context
)
->
assertThat
(
context
).
hasSingleBean
(
RSocketServerFactory
.
class
)
.
hasSingleBean
(
RSocketServerBootstrap
.
class
));
}
private
ApplicationContextRunner
c
reateC
ontextRunner
()
{
private
ApplicationContextRunner
contextRunner
()
{
return
new
ApplicationContextRunner
().
withUserConfiguration
(
BaseConfiguration
.
class
)
.
withConfiguration
(
AutoConfigurations
.
of
(
RSocketServerAutoConfiguration
.
class
));
}
private
ReactiveWebApplicationContextRunner
createR
eactiveWebContextRunner
()
{
private
ReactiveWebApplicationContextRunner
r
eactiveWebContextRunner
()
{
return
new
ReactiveWebApplicationContextRunner
().
withUserConfiguration
(
BaseConfiguration
.
class
)
.
withConfiguration
(
AutoConfigurations
.
of
(
RSocketServerAutoConfiguration
.
class
));
}
@Configuration
@Configuration
(
proxyBeanMethods
=
false
)
static
class
BaseConfiguration
{
@Bean
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfigurationTests.java
View file @
985c8f75
...
...
@@ -16,10 +16,10 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
rsocket
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
;
import
org.springframework.boot.rsocket.messaging.RSocketStrategiesCustomizer
;
import
org.springframework.boot.test.context.runner.ApplicationContextRunner
;
import
org.springframework.context.annotation.Bean
;
...
...
@@ -32,7 +32,6 @@ import org.springframework.http.codec.cbor.Jackson2CborDecoder;
import
org.springframework.http.codec.cbor.Jackson2CborEncoder
;
import
org.springframework.http.codec.json.Jackson2JsonDecoder
;
import
org.springframework.http.codec.json.Jackson2JsonEncoder
;
import
org.springframework.http.converter.json.Jackson2ObjectMapperBuilder
;
import
org.springframework.messaging.rsocket.RSocketStrategies
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -44,9 +43,8 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
class
RSocketStrategiesAutoConfigurationTests
{
private
ApplicationContextRunner
contextRunner
=
new
ApplicationContextRunner
()
.
withUserConfiguration
(
BaseConfiguration
.
class
)
.
withConfiguration
(
AutoConfigurations
.
of
(
RSocketStrategiesAutoConfiguration
.
class
));
private
final
ApplicationContextRunner
contextRunner
=
new
ApplicationContextRunner
().
withConfiguration
(
AutoConfigurations
.
of
(
JacksonAutoConfiguration
.
class
,
RSocketStrategiesAutoConfiguration
.
class
));
@Test
void
shouldCreateDefaultBeans
()
{
...
...
@@ -82,22 +80,7 @@ class RSocketStrategiesAutoConfigurationTests {
});
}
@Configuration
static
class
BaseConfiguration
{
@Bean
public
ObjectMapper
objectMapper
()
{
return
new
ObjectMapper
();
}
@Bean
public
Jackson2ObjectMapperBuilder
jackson2ObjectMapperBuilder
()
{
return
new
Jackson2ObjectMapperBuilder
();
}
}
@Configuration
@Configuration
(
proxyBeanMethods
=
false
)
static
class
UserStrategies
{
@Bean
...
...
@@ -108,7 +91,7 @@ class RSocketStrategiesAutoConfigurationTests {
}
@Configuration
@Configuration
(
proxyBeanMethods
=
false
)
static
class
StrategiesCustomizer
{
@Bean
...
...
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