Java 21460 Move code from spring-boot-swagger & spring-boot-swagger-2 to spring-boot-swagger-springfox module (#14310)
* JAVA-21460 Upgrade spring-boot-swagger-jwt modules to use SpringDoc in place of SpringFox * JAVA-21460 Upgrade spring-boot-swagger-2 module to use SpringDoc in place of SpringFox * JAVA-21460 Upgrade spring-boot-swagger module to use SpringDoc in place of SpringFox * JAVA-21460 Move code from spring-boot-swagger & spring-boot-swagger-2 to spring-boot-swagger-springfox module * JAVA-21457 Upgrade spring-security-web-rest to use SpringDoc in place of SpringFox
This commit is contained in:
parent
2f0f9d7e47
commit
44179d2187
@ -5,4 +5,3 @@
|
||||
- [Swagger @ApiParam vs @ApiModelProperty](https://www.baeldung.com/swagger-apiparam-vs-apimodelproperty)
|
||||
- [Map Date Types With OpenAPI Generator](https://www.baeldung.com/openapi-map-date-types)
|
||||
- [API First Development with Spring Boot and OpenAPI 3.0](https://www.baeldung.com/spring-boot-openapi-api-first-development)
|
||||
- [Change Swagger-UI URL prefix](https://www.baeldung.com/spring-boot-custom-swagger-url)
|
||||
|
@ -34,11 +34,6 @@
|
||||
<artifactId>springfox-oas</artifactId>
|
||||
<version>${springfox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${springfox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
@ -48,11 +43,6 @@
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${springfox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-spring-webmvc</artifactId>
|
||||
<version>${springfox.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -0,0 +1,7 @@
|
||||
## Relevant Articles:
|
||||
|
||||
- [Hiding Endpoints From Swagger Documentation in Spring Boot](https://www.baeldung.com/spring-swagger-hiding-endpoints)
|
||||
- [Swagger @Api Description Is Deprecated](https://www.baeldung.com/java-swagger-api-description-deprecated)
|
||||
- [Remove Basic Error Controller In SpringFox Swagger-UI](https://www.baeldung.com/spring-swagger-remove-error-controller)
|
||||
- [Change Swagger-UI URL prefix](https://www.baeldung.com/spring-boot-custom-swagger-url)
|
||||
- [Setting Up Swagger 2 with a Spring REST API Using Springfox](https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api)
|
39
spring-boot-modules/spring-boot-swagger-springfox/pom.xml
Normal file
39
spring-boot-modules/spring-boot-swagger-springfox/pom.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?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>
|
||||
<artifactId>spring-boot-swagger-springfox</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<name>spring-boot-swagger-springfox</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Module For Spring Boot Swagger Springfox</description>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung.spring-boot-modules</groupId>
|
||||
<artifactId>spring-boot-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>${springfox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<springfox.version>3.0.0</springfox.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
@ -0,0 +1,13 @@
|
||||
package com.baeldung.springdoc.demo.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
public class SwaggerController {
|
||||
|
||||
@RequestMapping("/myproject")
|
||||
public String getRedirectUrl() {
|
||||
return "redirect:swagger-ui.html";
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.baeldung.springdoc.demo.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baeldung.springdoc.demo.model.Topic;
|
||||
import com.baeldung.springdoc.demo.service.TopicService;
|
||||
|
||||
|
||||
@RestController
|
||||
public class TopicsController {
|
||||
|
||||
@Autowired
|
||||
TopicService topicService;
|
||||
|
||||
@GetMapping(value = "/topics")
|
||||
public ResponseEntity<List<Topic>> getAllTopics() {
|
||||
return new ResponseEntity<>(topicService.getAlllTopics(), HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.baeldung.springdoc.demo.model;
|
||||
|
||||
public class Topic {
|
||||
|
||||
Integer id;
|
||||
String name;
|
||||
|
||||
public Topic(Integer id, String name) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.baeldung.springdoc.demo.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baeldung.springdoc.demo.model.Topic;
|
||||
|
||||
@Service
|
||||
public class TopicService {
|
||||
|
||||
private List<Topic> topicsList;
|
||||
|
||||
public TopicService(){
|
||||
this.topicsList = new ArrayList<Topic>() {{
|
||||
add(new Topic(1, "Topic1"));
|
||||
add(new Topic(2, "Topic2"));
|
||||
add(new Topic(3, "Topic3"));
|
||||
}};
|
||||
}
|
||||
|
||||
public List<Topic> getAlllTopics(){
|
||||
return topicsList;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER
|
@ -4,8 +4,8 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.jayway.restassured.RestAssured;
|
||||
import com.jayway.restassured.response.Response;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class SwaggerLiveTest {
|
||||
private static final String URL_PREFIX = "http://localhost:8080/spring-security-rest/api";
|
@ -1,9 +1,6 @@
|
||||
## Relevant Articles:
|
||||
|
||||
- [Hiding Endpoints From Swagger Documentation in Spring Boot](https://www.baeldung.com/spring-swagger-hiding-endpoints)
|
||||
- [Swagger @Api Description Is Deprecated](https://www.baeldung.com/java-swagger-api-description-deprecated)
|
||||
- [Generate PDF from Swagger API Documentation](https://www.baeldung.com/swagger-generate-pdf)
|
||||
- [Remove Basic Error Controller In SpringFox Swagger-UI](https://www.baeldung.com/spring-swagger-remove-error-controller)
|
||||
- [Setting Example and Description with Swagger](https://www.baeldung.com/swagger-set-example-description)
|
||||
- [Document Enum in Swagger](https://www.baeldung.com/swagger-enum)
|
||||
- [@ApiOperation vs @ApiResponse in Swagger](https://www.baeldung.com/swagger-apioperation-vs-apiresponse)
|
||||
|
@ -20,11 +20,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>${springfox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.kongchen</groupId>
|
||||
<artifactId>swagger-maven-plugin</artifactId>
|
||||
@ -85,7 +80,6 @@
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<springfox.version>3.0.0</springfox.version>
|
||||
<swagger-maven-plugin.version>3.1.1</swagger-maven-plugin.version>
|
||||
<springdoc.version>1.7.0</springdoc.version>
|
||||
</properties>
|
||||
|
@ -9,7 +9,6 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
|
||||
|
||||
### Relevant Articles:
|
||||
|
||||
- [Setting Up Swagger 2 with a Spring REST API Using Springfox](https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api)
|
||||
- [Custom Error Message Handling for REST API](https://www.baeldung.com/global-error-handler-in-a-spring-rest-api)
|
||||
- [Spring Security Context Propagation with @Async](https://www.baeldung.com/spring-security-async-principal-propagation)
|
||||
- [Servlet 3 Async Support with Spring MVC and Spring Security](https://www.baeldung.com/spring-mvc-async-security)
|
||||
|
@ -139,17 +139,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- swagger -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${springfox-swagger.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${springfox-swagger.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
@ -246,8 +235,6 @@
|
||||
<javax.validation.version>1.1.0.Final</javax.validation.version>
|
||||
<!-- testing -->
|
||||
<rest-assured.version>2.9.0</rest-assured.version>
|
||||
<!-- swagger -->
|
||||
<springfox-swagger.version>3.0.0</springfox-swagger.version>
|
||||
<!-- Maven plugins -->
|
||||
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
|
||||
</properties>
|
||||
|
Loading…
x
Reference in New Issue
Block a user