BAEL-5329 : Updated code module

This commit is contained in:
soni.sk@1969 2022-04-14 21:31:50 +05:30
parent ce9fa68436
commit d8b5ab0111
7 changed files with 72 additions and 2 deletions

View File

@ -0,0 +1,4 @@
## Spring Boot MVC
This module contains articles about Spring Web MVC in Spring Boot projects.

View File

@ -0,0 +1,62 @@
<?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-mvc-4</artifactId>
<name>spring-boot-mvc-4</name>
<packaging>jar</packaging>
<description>Module For Spring Boot</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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<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>
</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>

View File

@ -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) {

View File

@ -21,7 +21,7 @@ public class ArticlesController {
}
@PostMapping("")
public void addArticle(@RequestBody Article article) {
public void addArticle(@ModelAttribute Article article) {
articleService.addArticle(article);
}

View File

@ -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;

View File

@ -0,0 +1 @@
Welcome to Baeldung