Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de781c9
commit 516e404
Showing
6 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.1.4.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<groupId>site.exception</groupId> | ||
<artifactId>spring-boot-webflux-hello</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>spring-boot-webflux-hello</name> | ||
<description>Demo project for Spring Boot</description> | ||
|
||
<properties> | ||
<java.version>1.8</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-webflux</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.projectreactor</groupId> | ||
<artifactId>reactor-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
13 changes: 13 additions & 0 deletions
13
...rc/main/java/site/exception/springbootwebfluxhello/SpringBootWebfluxHelloApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package site.exception.springbootwebfluxhello; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class SpringBootWebfluxHelloApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(SpringBootWebfluxHelloApplication.class, args); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...rc/main/java/site/exception/springbootwebfluxhello/controller/HelloWebFluxController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package site.exception.springbootwebfluxhello.controller; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import reactor.core.publisher.Mono; | ||
import site.exception.springbootwebfluxhello.entity.User; | ||
|
||
/** | ||
* @author 犬小哈 (微信号: 小哈学Java) | ||
* @site 个人网站: www.exception.site | ||
* @date 2019/4/15 | ||
* @time 下午9:12 | ||
* @discription | ||
**/ | ||
@RestController | ||
public class HelloWebFluxController { | ||
|
||
@GetMapping("/hello") | ||
public String hello() { | ||
return "Hello, WebFlux !"; | ||
} | ||
|
||
@GetMapping("/user") | ||
public Mono<User> getUser() { | ||
User user = new User(); | ||
user.setName("犬小哈"); | ||
user.setDesc("欢迎关注我的公众号: 小哈学Java"); | ||
return Mono.just(user); | ||
} | ||
|
||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...g-boot-webflux-hello/src/main/java/site/exception/springbootwebfluxhello/entity/User.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package site.exception.springbootwebfluxhello.entity; | ||
|
||
/** | ||
* @author 犬小哈 (微信号: 小哈学Java) | ||
* @site 个人网站: www.exception.site | ||
* @date 2019/4/15 | ||
* @time 下午9:12 | ||
* @discription | ||
**/ | ||
public class User { | ||
|
||
/** | ||
* 姓名 | ||
*/ | ||
private String name; | ||
/** | ||
* 描述 | ||
*/ | ||
private String desc; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getDesc() { | ||
return desc; | ||
} | ||
|
||
public void setDesc(String desc) { | ||
this.desc = desc; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
spring-boot-webflux-hello/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
16 changes: 16 additions & 0 deletions
16
...st/java/site/exception/springbootwebfluxhello/SpringBootWebfluxHelloApplicationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package site.exception.springbootwebfluxhello; | ||
|
||
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 SpringBootWebfluxHelloApplicationTests { | ||
|
||
@Test | ||
public void contextLoads() { | ||
} | ||
|
||
} |