Merge branch 'master' of https://github.com/eugenp/tutorials into BAEL_3301_testing_@ConfigurationProperties

This commit is contained in:
m.raheem
2020-02-27 16:38:21 +02:00
398 changed files with 4074 additions and 10389 deletions
+1
View File
@@ -43,6 +43,7 @@
<module>spring-boot-mvc-2</module>
<module>spring-boot-mvc-birt</module>
<module>spring-boot-nashorn</module>
<module>spring-boot-parent</module>
<module>spring-boot-performance</module>
<module>spring-boot-properties</module>
<module>spring-boot-property-exp</module>
@@ -16,11 +16,12 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
public class Swagger2Config {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).select()
.apis(RequestHandlerSelectors.basePackage("com.baeldung.swagger2boot.controller"))
.paths(PathSelectors.regex("/.*"))
.build()
.apiInfo(apiEndPointsInfo());
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.apiInfo(apiEndPointsInfo());
}
private ApiInfo apiEndPointsInfo() {
@@ -0,0 +1,39 @@
package com.baeldung.swagger2boot.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 javax.validation.Valid;
import javax.websocket.server.PathParam;
import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
@Controller
public class UserController {
public UserController() {
super();
} //@formatter:off
@RequestMapping(method = RequestMethod.POST, value = "/createUser", produces = "application/json; charset=UTF-8")
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
@ApiOperation(value = "Create user",
notes = "This method creates a new user")
public User createUser(@ApiParam(
name = "firstName",
type = "String",
value = "First Name of the user",
example = "Vatsal",
required = true) @RequestParam String firstName) { //@formatter:on
User user = new User(firstName);
return user;
}
}
@@ -0,0 +1,28 @@
package com.baeldung.swagger2boot.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel
public class User {
@ApiModelProperty(value = "first name of the user", name = "firstName", dataType = "String", example = "Vatsal")
String firstName;
public User() {
super();
}
public User(final String firstName) {
super();
this.firstName = firstName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
}
@@ -0,0 +1,7 @@
## Spring Boot Parent
This module contains articles about Spring Boot Starter Parent
### Relevant Articles
- [The Spring Boot Starter Parent](https://www.baeldung.com/spring-boot-starter-parent)
@@ -0,0 +1,23 @@
<?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-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>spring-boot-parent</name>
<packaging>pom</packaging>
<description>spring-boot-parent</description>
<parent>
<groupId>com.baeldung.spring-boot-modules</groupId>
<artifactId>spring-boot-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>spring-boot-with-starter-parent</module>
<module>spring-boot-with-custom-parent</module>
</modules>
</project>
@@ -0,0 +1,28 @@
<?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-with-custom-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>spring-boot-with-custom-parent</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-boot-2</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
</project>
@@ -0,0 +1,13 @@
package com.baeldung.customparent;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootStarterCustomParentApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootStarterCustomParentApplication.class, args);
System.out.println("Spring boot application running without starter parent");
}
}
@@ -0,0 +1,45 @@
<?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>
<groupId>com.baeldung</groupId>
<artifactId>spring-boot-with-starter-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>spring-boot-with-starter-parent</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-boot-2</relativePath>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${spring-boot.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
<spring-boot.version>2.1.5.RELEASE</spring-boot.version>
<junit.version>4.11</junit.version>
</properties>
</project>
@@ -0,0 +1,14 @@
package com.baeldung.starterparent;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootStarterParentApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootStarterParentApplication.class, args);
System.out.println("Spring boot application running with starter parent");
}
}