diff --git a/spring-boot-webflux/pom.xml b/spring-boot-webflux/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..494dca51308c5761037e5a8423fd7dd59df10e3d --- /dev/null +++ b/spring-boot-webflux/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + com.neo + spring-boot-webfluxflux + 1.0.0-SNAPSHOT + jar + + spring-boot-webfluxflux + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 2.1.2.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-webflux + + + org.springframework.boot + spring-boot-devtools + runtime + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/spring-boot-webflux/src/main/java/com/neo/WebFluxApplication.java b/spring-boot-webflux/src/main/java/com/neo/WebFluxApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..b89527d352a1a48e2e91fccec91b6f42c891f085 --- /dev/null +++ b/spring-boot-webflux/src/main/java/com/neo/WebFluxApplication.java @@ -0,0 +1,12 @@ +package com.neo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class WebFluxApplication { + + public static void main(String[] args) { + SpringApplication.run(WebFluxApplication.class, args); + } +} diff --git a/spring-boot-webflux/src/main/java/com/neo/web/HelloController.java b/spring-boot-webflux/src/main/java/com/neo/web/HelloController.java new file mode 100644 index 0000000000000000000000000000000000000000..681a1542f417a6da0647778de45f5173823315eb --- /dev/null +++ b/spring-boot-webflux/src/main/java/com/neo/web/HelloController.java @@ -0,0 +1,14 @@ +package com.neo.web; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; + +@RestController +public class HelloController { + + @GetMapping("/hello") + public Mono hello() { + return Mono.just("Welcome to reactive world ~"); + } +} diff --git a/spring-boot-webflux/src/main/resources/application.properties b/spring-boot-webflux/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/spring-boot-webflux/src/test/java/com/neo/HelloTests.java b/spring-boot-webflux/src/test/java/com/neo/HelloTests.java new file mode 100644 index 0000000000000000000000000000000000000000..aa9389c5f13cfc4d9ec9ebaf952e73addcd5dc66 --- /dev/null +++ b/spring-boot-webflux/src/test/java/com/neo/HelloTests.java @@ -0,0 +1,21 @@ +package com.neo; + +import com.neo.web.HelloController; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; + +@RunWith(SpringRunner.class) +@WebFluxTest(controllers = HelloController.class) +public class HelloTests { + @Autowired + WebTestClient client; + + @Test + public void getHello() { + client.get().uri("/hello").exchange().expectStatus().isOk(); + } +} diff --git a/spring-boot-webflux/src/test/java/com/neo/WebFluxApplicationTests.java b/spring-boot-webflux/src/test/java/com/neo/WebFluxApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..b7b4ed765c8bde3918376fb62bfdcc19bed07b3d --- /dev/null +++ b/spring-boot-webflux/src/test/java/com/neo/WebFluxApplicationTests.java @@ -0,0 +1,16 @@ +package com.neo; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class WebFluxApplicationTests { + + @Test + public void contextLoads() { + } + +}