From 1c854b47ac98eaa9823c7c389074ab189b1f12a3 Mon Sep 17 00:00:00 2001 From: Oleh Dokuka Date: Tue, 25 Dec 2018 21:03:34 +0200 Subject: [PATCH] fix issue with autoconfiguring --- build.gradle | 9 +++++++++ settings.gradle | 2 +- .../io/rsocket/spring/boot/RSocketServerProperties.java | 2 +- .../boot/RSocketWebServerFactoryAutoConfiguration.java | 4 +++- .../src/main/resources/META-INF/spring.factories | 2 ++ 5 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 spring-boot-autoconfigure-rsocket/src/main/resources/META-INF/spring.factories diff --git a/build.gradle b/build.gradle index 0a81069..3fa16e8 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,7 @@ allprojects { apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'io.spring.dependency-management' + apply plugin: 'maven-publish' group = 'io.rsocket.spring.boot' version = '0.0.1.RELEASE' @@ -45,4 +46,12 @@ allprojects { } } } + + publishing { + publications { + maven(MavenPublication) { + from components.java + } + } + } } diff --git a/settings.gradle b/settings.gradle index 9010685..b7dcef3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -rootProject.name = 'demo' +rootProject.name = 'spring-boot-rsocket' include 'spring-boot-autoconfigure-rsocket' diff --git a/spring-boot-autoconfigure-rsocket/src/main/java/io/rsocket/spring/boot/RSocketServerProperties.java b/spring-boot-autoconfigure-rsocket/src/main/java/io/rsocket/spring/boot/RSocketServerProperties.java index 8fe47af..bfd7011 100644 --- a/spring-boot-autoconfigure-rsocket/src/main/java/io/rsocket/spring/boot/RSocketServerProperties.java +++ b/spring-boot-autoconfigure-rsocket/src/main/java/io/rsocket/spring/boot/RSocketServerProperties.java @@ -4,7 +4,7 @@ @ConfigurationProperties(prefix = "rsocket.server", ignoreUnknownFields = true) public class RSocketServerProperties { - private String path; + private String path = "/rs"; public String getPath() { return path; diff --git a/spring-boot-autoconfigure-rsocket/src/main/java/io/rsocket/spring/boot/RSocketWebServerFactoryAutoConfiguration.java b/spring-boot-autoconfigure-rsocket/src/main/java/io/rsocket/spring/boot/RSocketWebServerFactoryAutoConfiguration.java index b1ecd91..dcb851f 100644 --- a/spring-boot-autoconfigure-rsocket/src/main/java/io/rsocket/spring/boot/RSocketWebServerFactoryAutoConfiguration.java +++ b/spring-boot-autoconfigure-rsocket/src/main/java/io/rsocket/spring/boot/RSocketWebServerFactoryAutoConfiguration.java @@ -62,13 +62,15 @@ public ReactorResourceFactory reactorServerResourceFactory() { } @Bean - public RSocketNettyReactiveWebServerFactory nettyReactiveWebServerFactory( + public RSocketNettyReactiveWebServerFactory rSocketNettyReactiveWebServerFactory( ReactorResourceFactory resourceFactory, + RSocketServerProperties rSocketServerProperties, SocketAcceptor socketAcceptor ) { RSocketNettyReactiveWebServerFactory serverFactory = new RSocketNettyReactiveWebServerFactory(); serverFactory.setResourceFactory(resourceFactory); serverFactory.setSocketAcceptor(socketAcceptor); + serverFactory.setPath(rSocketServerProperties.getPath()); return serverFactory; } } diff --git a/spring-boot-autoconfigure-rsocket/src/main/resources/META-INF/spring.factories b/spring-boot-autoconfigure-rsocket/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..d862769 --- /dev/null +++ b/spring-boot-autoconfigure-rsocket/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + io.rsocket.spring.boot.RSocketWebServerFactoryAutoConfiguration \ No newline at end of file