Skip to content

Commit 07de711

Browse files
Suman DasSuman Das
Suman Das
authored and
Suman Das
committed
fixed Swagger issue
1 parent b1f9cb8 commit 07de711

11 files changed

+95
-49
lines changed

.gitignore

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
target/
2-
*.iml
3-
dependency-reduced-pom.xml
1+
# Intellij
42
.idea/
5-
.DS_Store
3+
*.iml
4+
*.iws
5+
6+
# Mac
7+
.DS_Store
8+
9+
# Maven
10+
log/
11+
target/

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Suman Das
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# Sample Reactive - Spring Boot application
2-
The purpose of this project is to demonstrate how we can use [Spring WebFlux](https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html) to create a simple reactive web application.
1+
# Sample Reactive - Spring Boot application
2+
3+
The purpose of this project is to demonstrate how we can
4+
use [Spring WebFlux](https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html) to create
5+
a simple reactive web application.
36

47
This project uses [PostgreSQL](https://github.com/r2dbc/r2dbc-postgresql) implementation of the R2DBC SPI.
58

@@ -9,20 +12,29 @@ project can be compiled with JDK 8 and above `javac`.
912

1013
To compile just do `mvn clean package`.
1114

15+
## Prerequisites
16+
17+
* JAVA 8 should be installed
18+
* Postgres should be up and running at : <localhost:5432>
19+
1220
To run the application execute the following:
21+
1322
```
1423
java -jar target/reactive-examples*.jar
1524
```
16-
You can also use the Swagger-ui.html to test the application.
17-
![alt text](react-starter-demo.png)
1825

19-
for more detailed technical information please check my post :
26+
You can also use the Swagger-UI to test the application.
27+
![alt text](react-starter-demo.png)
2028

29+
for more detailed technical information please check my
30+
post : <https://dassum.medium.com/building-a-reactive-restful-web-service-using-spring-boot-and-postgres-c8e157dbc81d>
2131

2232
The server will start at <http://localhost:8080>.
2333

2434
## Exploring the Rest APIs
2535

36+
The Swagger UI will open at : <http://localhost:8080/swagger-ui/index.html>
37+
2638
The application contains the following REST APIs
2739

2840
```
@@ -38,6 +50,7 @@ The application contains the following REST APIs
3850
3951
4. GET /users/events - Stream users to a browser as Server-Sent Events
4052
```
53+
4154
It contain a sample WebClient to retrieve data from our User Management application.
4255

4356

pom.xml

+8-3
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,22 @@
7373
<dependency>
7474
<groupId>io.springfox</groupId>
7575
<artifactId>springfox-swagger2</artifactId>
76-
<version>3.0.0-SNAPSHOT</version>
76+
<version>3.0.0</version>
7777
</dependency>
7878
<dependency>
7979
<groupId>io.springfox</groupId>
8080
<artifactId>springfox-swagger-ui</artifactId>
81-
<version>3.0.0-SNAPSHOT</version>
81+
<version>3.0.0</version>
82+
</dependency>
83+
<dependency>
84+
<groupId>io.springfox</groupId>
85+
<artifactId>springfox-boot-starter</artifactId>
86+
<version>3.0.0</version>
8287
</dependency>
8388
<dependency>
8489
<groupId>io.springfox</groupId>
8590
<artifactId>springfox-spring-webflux</artifactId>
86-
<version>3.0.0-SNAPSHOT</version>
91+
<version>3.0.0</version>
8792
</dependency>
8893
</dependencies>
8994

spring-boot-reactive-webflux.iml

+20-13
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,30 @@
100100
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.2.6.RELEASE" level="project" />
101101
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.4" level="project" />
102102
<orderEntry type="library" scope="TEST" name="Maven: io.projectreactor:reactor-test:3.3.5.RELEASE" level="project" />
103-
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:3.0.0-SNAPSHOT" level="project" />
104-
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
105-
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
106-
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.0" level="project" />
107-
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:3.0.0-SNAPSHOT" level="project" />
108-
<orderEntry type="library" name="Maven: io.springfox:springfox-core:3.0.0-SNAPSHOT" level="project" />
109-
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:3.0.0-SNAPSHOT" level="project" />
110-
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:3.0.0-SNAPSHOT" level="project" />
111-
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:3.0.0-SNAPSHOT" level="project" />
112-
<orderEntry type="library" name="Maven: io.github.classgraph:classgraph:4.1.7" level="project" />
103+
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:3.0.0" level="project" />
104+
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:3.0.0" level="project" />
105+
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:3.0.0" level="project" />
106+
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:3.0.0" level="project" />
107+
<orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-annotations:2.1.2" level="project" />
108+
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:3.0.0" level="project" />
109+
<orderEntry type="library" name="Maven: io.github.classgraph:classgraph:4.8.83" level="project" />
110+
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-webmvc:3.0.0" level="project" />
113111
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
114112
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
115113
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE" level="project" />
116114
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.6.RELEASE" level="project" />
117115
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:2.0.0.RELEASE" level="project" />
118-
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.3.1.Final" level="project" />
119-
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:3.0.0-SNAPSHOT" level="project" />
120-
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-webflux:3.0.0-SNAPSHOT" level="project" />
116+
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
117+
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
118+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.0" level="project" />
119+
<orderEntry type="library" scope="RUNTIME" name="Maven: org.mapstruct:mapstruct:1.3.1.Final" level="project" />
120+
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:3.0.0" level="project" />
121+
<orderEntry type="library" name="Maven: io.springfox:springfox-boot-starter:3.0.0" level="project" />
122+
<orderEntry type="library" name="Maven: io.springfox:springfox-oas:3.0.0" level="project" />
123+
<orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-models:2.1.2" level="project" />
124+
<orderEntry type="library" name="Maven: io.springfox:springfox-data-rest:3.0.0" level="project" />
125+
<orderEntry type="library" name="Maven: io.springfox:springfox-bean-validators:3.0.0" level="project" />
126+
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-webflux:3.0.0" level="project" />
127+
<orderEntry type="library" name="Maven: io.springfox:springfox-core:3.0.0" level="project" />
121128
</component>
122129
</module>
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
package com.reactive.examples.config;
22

3-
import org.reactivestreams.Publisher;
43
import org.springframework.context.annotation.Bean;
54
import org.springframework.context.annotation.Configuration;
6-
import org.springframework.web.reactive.config.ResourceHandlerRegistry;
75
import org.springframework.web.reactive.config.WebFluxConfigurer;
8-
import reactor.core.publisher.Flux;
9-
import reactor.core.publisher.Mono;
106
import springfox.documentation.builders.ApiInfoBuilder;
117
import springfox.documentation.builders.PathSelectors;
128
import springfox.documentation.builders.RequestHandlerSelectors;
139
import springfox.documentation.service.ApiInfo;
1410
import springfox.documentation.spi.DocumentationType;
1511
import springfox.documentation.spring.web.plugins.Docket;
16-
import springfox.documentation.swagger2.annotations.EnableSwagger2WebFlux;
1712

1813
@Configuration
19-
@EnableSwagger2WebFlux
2014
public class SwaggerConfiguration implements WebFluxConfigurer {
2115
@Bean
2216
public Docket api() {
@@ -30,9 +24,9 @@ public Docket api() {
3024
.build();
3125
}
3226

33-
private ApiInfo apiInfo(){
27+
private ApiInfo apiInfo() {
3428
return new ApiInfoBuilder().title("Reactive Stream Starter Demo")
35-
.description("Reactive Stream Starter Demo")
36-
.version("1.0").build();
29+
.description("Reactive Stream Starter Demo")
30+
.version("1.0").build();
3731
}
3832
}
Binary file not shown.
793 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)