Merge pull request #12066 from priya-soni/master
BAEL-5329 - Updated code module
This commit is contained in:
commit
450d5fb7f4
|
@ -8,4 +8,3 @@ This module contains articles about Spring Web MVC in Spring Boot projects.
|
|||
- [Guide to Spring WebUtils and ServletRequestUtils](https://www.baeldung.com/spring-webutils-servletrequestutils)
|
||||
- [Configure a Spring Boot Web Application](https://www.baeldung.com/spring-boot-application-configuration)
|
||||
- [A Guide to Spring in Eclipse STS](https://www.baeldung.com/eclipse-sts-spring)
|
||||
- More articles: [[<-- Prev]](/spring-boot-modules/spring-boot-mvc-3)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<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-mvc-4</artifactId>
|
||||
<name>spring-boot-mvc-4</name>
|
||||
|
@ -19,13 +20,27 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>${spring.fox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -42,4 +57,23 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>${start-class}</mainClass>
|
||||
<layout>JAR</layout>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<properties>
|
||||
<spring.fox.version>3.0.0</spring.fox.version>
|
||||
<start-class>com.baeldung.springboot.swagger.ArticleApplication</start-class>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
|
@ -12,6 +13,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||
|
||||
@SpringBootApplication
|
||||
@EnableSwagger2
|
||||
@EnableWebMvc
|
||||
public class ArticleApplication {
|
||||
|
||||
public static void main(String[] args) {
|
|
@ -21,7 +21,7 @@ public class ArticlesController {
|
|||
}
|
||||
|
||||
@PostMapping("")
|
||||
public void addArticle(@RequestBody Article article) {
|
||||
public void addArticle(@ModelAttribute Article article) {
|
||||
articleService.addArticle(article);
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ public class Article {
|
|||
//@ApiModelProperty(hidden = true)
|
||||
//@ApiParam(hidden = true)
|
||||
//@ApiModelProperty(readOnly = true)
|
||||
@ApiParam(hidden = true)
|
||||
private int id;
|
||||
private String title;
|
||||
private int numOfWords;
|
|
@ -0,0 +1 @@
|
|||
Welcome to Baeldung
|
Loading…
Reference in New Issue