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
71362299
Commit
71362299
authored
Apr 15, 2019
by
Brian Clozel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish RSocket server bootstrap
See gh-16021
parent
d4c47a13
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
RSocketServerAutoConfiguration.java
...autoconfigure/rsocket/RSocketServerAutoConfiguration.java
+7
-6
RSocketServerAutoConfigurationTests.java
...onfigure/rsocket/RSocketServerAutoConfigurationTests.java
+5
-5
RSocketServerBootstrap.java
...framework/boot/rsocket/server/RSocketServerBootstrap.java
+3
-5
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java
View file @
71362299
...
...
@@ -18,9 +18,10 @@ package org.springframework.boot.autoconfigure.rsocket;
import
java.util.stream.Collectors
;
import
io.netty.buffer.PooledByteBufAllocator
;
import
io.rsocket.RSocketFactory
;
import
io.rsocket.SocketAcceptor
;
import
io.rsocket.transport.netty.server.TcpServerTransport
;
import
reactor.netty.http.server.HttpServer
;
import
org.springframework.beans.factory.ObjectProvider
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
...
...
@@ -33,7 +34,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.PropertyMapper
;
import
org.springframework.boot.rsocket.
netty.NettyRSocket
Bootstrap
;
import
org.springframework.boot.rsocket.
server.RSocketServer
Bootstrap
;
import
org.springframework.boot.rsocket.netty.NettyRSocketServerFactory
;
import
org.springframework.boot.rsocket.server.RSocketServerFactory
;
import
org.springframework.boot.rsocket.server.ServerRSocketFactoryCustomizer
;
...
...
@@ -57,8 +58,8 @@ import org.springframework.messaging.rsocket.RSocketStrategies;
* @since 2.2.0
*/
@Configuration
(
proxyBeanMethods
=
false
)
@ConditionalOnClass
({
RSocketFactory
.
class
,
RSocketStrategies
.
class
,
PooledByteBufAllocator
.
class
})
@ConditionalOnClass
({
RSocketFactory
.
class
,
RSocketStrategies
.
class
,
HttpServer
.
class
,
TcpServerTransport
.
class
})
@ConditionalOnBean
(
MessageHandlerAcceptor
.
class
)
@AutoConfigureAfter
(
RSocketStrategiesAutoConfiguration
.
class
)
@EnableConfigurationProperties
(
RSocketProperties
.
class
)
...
...
@@ -105,10 +106,10 @@ public class RSocketServerAutoConfiguration {
}
@Bean
public
NettyRSocket
Bootstrap
nettyRSocketBootstrap
(
public
RSocketServer
Bootstrap
nettyRSocketBootstrap
(
RSocketServerFactory
rSocketServerFactory
,
SocketAcceptor
socketAcceptor
)
{
return
new
NettyRSocket
Bootstrap
(
rSocketServerFactory
,
socketAcceptor
);
return
new
RSocketServer
Bootstrap
(
rSocketServerFactory
,
socketAcceptor
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfigurationTests.java
View file @
71362299
...
...
@@ -19,7 +19,7 @@ package org.springframework.boot.autoconfigure.rsocket;
import
org.junit.Test
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.rsocket.
netty.NettyRSocket
Bootstrap
;
import
org.springframework.boot.rsocket.
server.RSocketServer
Bootstrap
;
import
org.springframework.boot.rsocket.server.RSocketServerFactory
;
import
org.springframework.boot.test.context.runner.ApplicationContextRunner
;
import
org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner
;
...
...
@@ -46,7 +46,7 @@ public class RSocketServerAutoConfigurationTests {
contextRunner
.
run
((
context
)
->
assertThat
(
context
)
.
doesNotHaveBean
(
WebServerFactoryCustomizer
.
class
)
.
doesNotHaveBean
(
RSocketServerFactory
.
class
)
.
doesNotHaveBean
(
NettyRSocket
Bootstrap
.
class
));
.
doesNotHaveBean
(
RSocketServer
Bootstrap
.
class
));
}
@Test
...
...
@@ -55,7 +55,7 @@ public class RSocketServerAutoConfigurationTests {
contextRunner
.
run
((
context
)
->
assertThat
(
context
)
.
doesNotHaveBean
(
WebServerFactoryCustomizer
.
class
)
.
doesNotHaveBean
(
RSocketServerFactory
.
class
)
.
doesNotHaveBean
(
NettyRSocket
Bootstrap
.
class
));
.
doesNotHaveBean
(
RSocketServer
Bootstrap
.
class
));
}
@Test
...
...
@@ -67,7 +67,7 @@ public class RSocketServerAutoConfigurationTests {
.
run
((
context
)
->
assertThat
(
context
)
.
doesNotHaveBean
(
WebServerFactoryCustomizer
.
class
)
.
doesNotHaveBean
(
RSocketServerFactory
.
class
)
.
doesNotHaveBean
(
NettyRSocket
Bootstrap
.
class
));
.
doesNotHaveBean
(
RSocketServer
Bootstrap
.
class
));
}
@Test
...
...
@@ -87,7 +87,7 @@ public class RSocketServerAutoConfigurationTests {
contextRunner
.
withPropertyValues
(
"spring.rsocket.server.port=0"
)
.
run
((
context
)
->
assertThat
(
context
)
.
hasSingleBean
(
RSocketServerFactory
.
class
)
.
hasSingleBean
(
NettyRSocket
Bootstrap
.
class
));
.
hasSingleBean
(
RSocketServer
Bootstrap
.
class
));
}
private
ApplicationContextRunner
createContextRunner
()
{
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/
netty/NettyRSocket
Bootstrap.java
→
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/
server/RSocketServer
Bootstrap.java
View file @
71362299
...
...
@@ -14,13 +14,11 @@
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
rsocket
.
netty
;
package
org
.
springframework
.
boot
.
rsocket
.
server
;
import
io.rsocket.SocketAcceptor
;
import
org.springframework.boot.rsocket.context.RSocketServerInitializedEvent
;
import
org.springframework.boot.rsocket.server.RSocketServer
;
import
org.springframework.boot.rsocket.server.RSocketServerFactory
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.context.ApplicationEventPublisherAware
;
import
org.springframework.context.SmartLifecycle
;
...
...
@@ -31,14 +29,14 @@ import org.springframework.context.SmartLifecycle;
* @author Brian Clozel
* @since 2.2.0
*/
public
class
NettyRSocket
Bootstrap
public
class
RSocketServer
Bootstrap
implements
ApplicationEventPublisherAware
,
SmartLifecycle
{
private
final
RSocketServer
rSocketServer
;
private
ApplicationEventPublisher
applicationEventPublisher
;
public
NettyRSocket
Bootstrap
(
RSocketServerFactory
serverFactoryProvider
,
public
RSocketServer
Bootstrap
(
RSocketServerFactory
serverFactoryProvider
,
SocketAcceptor
socketAcceptor
)
{
this
.
rSocketServer
=
serverFactoryProvider
.
create
(
socketAcceptor
);
}
...
...
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