Merge pull request #12789 from panos-kakos/JAVA-14985

[JAVA-14985] Moved code related to articles from spring-boot-mvc-2 to…
This commit is contained in:
Loredana Crusoveanu 2022-09-30 11:09:02 +03:00 committed by GitHub
commit 2d40c9c71d
11 changed files with 42 additions and 39 deletions

View File

@ -5,8 +5,6 @@ This module contains articles about Spring Web MVC in Spring Boot projects.
### Relevant Articles:
- [Functional Controllers in Spring MVC](https://www.baeldung.com/spring-mvc-functional-controllers)
- [Specify an Array of Strings as Body Parameters in Swagger](https://www.baeldung.com/swagger-body-array-of-strings)
- [Swagger @ApiParam vs @ApiModelProperty](https://www.baeldung.com/swagger-apiparam-vs-apimodelproperty)
- [Testing REST with multiple MIME types](https://www.baeldung.com/testing-rest-api-with-multiple-media-types)
- [Testing Web APIs with Postman Collections](https://www.baeldung.com/postman-testing-collections)
- [Spring Boot Consuming and Producing JSON](https://www.baeldung.com/spring-boot-json)

View File

@ -28,22 +28,6 @@
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!-- Swagger dependencies for REST documentation -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${spring.fox.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${spring.fox.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-webmvc</artifactId>
<version>${spring.fox.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
@ -90,8 +74,7 @@
<properties>
<spring.fox.version>3.0.0</spring.fox.version>
<start-class>com.baeldung.swagger2boot.SpringBootSwaggerApplication</start-class>
<!-- <start-class>com.baeldung.springbootmvc.SpringBootMvcFnApplication</start-class> -->
<start-class>com.baeldung.springbootmvc.SpringBootMvcFnApplication</start-class>
<xstream.version>1.4.11.1</xstream.version>
</properties>

View File

@ -1,3 +1,5 @@
### Relevant Articles:
- [Swagger: Specify Two Responses with the Same Response Code](https://www.baeldung.com/swagger-two-responses-one-response-code)
- [Specify an Array of Strings as Body Parameters in Swagger](https://www.baeldung.com/swagger-body-array-of-strings)
- [Swagger @ApiParam vs @ApiModelProperty](https://www.baeldung.com/swagger-apiparam-vs-apimodelproperty)

View File

@ -39,6 +39,16 @@
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<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>
@ -63,6 +73,13 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>${start-class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
@ -70,6 +87,8 @@
<springfox.version>3.0.0</springfox.version>
<swagger-codegen-maven-plugin.version>3.0.34</swagger-codegen-maven-plugin.version>
<springdoc.version>1.6.10</springdoc.version>
<swagger-maven-plugin.version>3.1.1</swagger-maven-plugin.version>
<start-class>com.baeldung.tworesponses.Application</start-class>
</properties>
</project>

View File

@ -1,4 +1,4 @@
package com.baeldung.swagger2boot;
package com.baeldung.swagger2bootmvc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,7 +1,8 @@
package com.baeldung.swagger2boot.config;
package com.baeldung.swagger2bootmvc.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
@ -9,10 +10,12 @@ import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2WebMvc
@EnableWebMvc
@EnableSwagger2
public class Swagger2Config {
@Bean
public Docket api() {

View File

@ -1,4 +1,4 @@
package com.baeldung.swagger2boot.controller;
package com.baeldung.swagger2bootmvc.controller;
import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import com.baeldung.swagger2boot.model.Foo;
import com.baeldung.swagger2bootmvc.model.Foo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -1,19 +1,17 @@
package com.baeldung.swagger2boot.controller;
package com.baeldung.swagger2bootmvc.controller;
import com.baeldung.swagger2boot.model.Foo;
import com.baeldung.swagger2boot.model.User;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import javax.validation.Valid;
import javax.websocket.server.PathParam;
import com.baeldung.swagger2bootmvc.model.User;
import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@Controller
public class UserController {

View File

@ -1,4 +1,4 @@
package com.baeldung.swagger2boot.model;
package com.baeldung.swagger2bootmvc.model;
import java.util.List;

View File

@ -1,4 +1,4 @@
package com.baeldung.swagger2boot.model;
package com.baeldung.swagger2bootmvc.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;