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)
|
- [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)
|
- [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)
|
- [A Guide to Spring in Eclipse STS](https://www.baeldung.com/eclipse-sts-spring)
|
||||||
- More articles: [[<-- Prev]](/spring-boot-modules/spring-boot-mvc-3)
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>spring-boot-mvc-4</artifactId>
|
<artifactId>spring-boot-mvc-4</artifactId>
|
||||||
<name>spring-boot-mvc-4</name>
|
<name>spring-boot-mvc-4</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>Module For Spring Boot MVC Web</description>
|
<description>Module For Spring Boot MVC Web</description>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung.spring-boot-modules</groupId>
|
<groupId>com.baeldung.spring-boot-modules</groupId>
|
||||||
<artifactId>spring-boot-modules</artifactId>
|
<artifactId>spring-boot-modules</artifactId>
|
||||||
@ -19,13 +20,27 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<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>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@ -42,4 +57,23 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</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>
|
</project>
|
@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
@ -12,6 +13,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
|
@EnableWebMvc
|
||||||
public class ArticleApplication {
|
public class ArticleApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
@ -21,7 +21,7 @@ public class ArticlesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("")
|
@PostMapping("")
|
||||||
public void addArticle(@RequestBody Article article) {
|
public void addArticle(@ModelAttribute Article article) {
|
||||||
articleService.addArticle(article);
|
articleService.addArticle(article);
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ public class Article {
|
|||||||
//@ApiModelProperty(hidden = true)
|
//@ApiModelProperty(hidden = true)
|
||||||
//@ApiParam(hidden = true)
|
//@ApiParam(hidden = true)
|
||||||
//@ApiModelProperty(readOnly = true)
|
//@ApiModelProperty(readOnly = true)
|
||||||
|
@ApiParam(hidden = true)
|
||||||
private int id;
|
private int id;
|
||||||
private String title;
|
private String title;
|
||||||
private int numOfWords;
|
private int numOfWords;
|
@ -20,6 +20,6 @@ public class ArticleService {
|
|||||||
article.setId(articles.size() + 1);
|
article.setId(articles.size() + 1);
|
||||||
articles.add(article);
|
articles.add(article);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1 @@
|
|||||||
|
Welcome to Baeldung
|
Loading…
x
Reference in New Issue
Block a user