Merge pull request #5903 from rozagerardo/geroza/BAEL-10845_subtask-part-1_BAEL-10354_migrateparent-boot-to-spring-boot-2.1_part-3

[BAEL-10845] | Upgrade set of modules to use boot 2.1 - part 3
This commit is contained in:
Loredana Crusoveanu 2018-12-15 18:26:15 +02:00 committed by GitHub
commit 76e8d10bc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 73 additions and 191 deletions

View File

@ -1,2 +0,0 @@
This pom will be ued only temporary until we migrate parent-boot-2 to 2.1.0 for ticket BAEL-10354

View File

@ -1,85 +0,0 @@
<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>parent-boot-2.0-temp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<description>Temporary Parent for all Spring Boot 2.0.x modules</description>
<!-- This pom will be ued only temporary until we migrate parent-boot-2 to 2.1.0 for ticket BAEL-10354 -->
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<mainClass>${start-class}</mainClass>
<!-- this is necessary as we're not using the Boot parent -->
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>thin-jar</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<!-- The following enables the "thin jar" deployment option. -->
<dependency>
<groupId>org.springframework.boot.experimental</groupId>
<artifactId>spring-boot-thin-layout</artifactId>
<version>${thin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<rest-assured.version>3.1.0</rest-assured.version>
<!-- plugins -->
<thin.version>1.0.11.RELEASE</thin.version>
<spring-boot.version>2.0.5.RELEASE</spring-boot.version>
</properties>
</project>

View File

@ -324,7 +324,6 @@
<modules>
<module>parent-boot-1</module>
<module>parent-boot-2</module>
<module>parent-boot-2.0-temp</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-java</module>
@ -590,7 +589,6 @@
<modules>
<module>parent-boot-1</module>
<module>parent-boot-2</module>
<module>parent-boot-2.0-temp</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-java</module>
@ -985,7 +983,6 @@
<modules>
<module>parent-boot-1</module>
<module>parent-boot-2</module>
<module>parent-boot-2.0-temp</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-java</module>
@ -1038,7 +1035,6 @@
<modules>
<module>parent-boot-1</module>
<module>parent-boot-2</module>
<module>parent-boot-2.0-temp</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-java</module>
@ -1300,7 +1296,6 @@
<modules>
<module>parent-boot-1</module>
<module>parent-boot-2</module>
<module>parent-boot-2.0-temp</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-java</module>
@ -1536,7 +1531,6 @@
<modules>
<module>parent-boot-1</module>
<module>parent-boot-2</module>
<module>parent-boot-2.0-temp</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-java</module>

View File

@ -2,3 +2,4 @@
- [Session Attributes in Spring MVC](http://www.baeldung.com/spring-mvc-session-attributes)
- [Binding a List in Thymeleaf](http://www.baeldung.com/thymeleaf-list)

View File

@ -9,10 +9,10 @@
<description>spring forms examples using thymeleaf</description>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -8,10 +8,10 @@
<packaging>war</packaging>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -6,12 +6,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.web.filter.ShallowEtagHeaderFilter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@SpringBootApplication
@EnableAutoConfiguration
@Import(PersistenceConfig.class)
public class Application extends WebMvcConfigurerAdapter {
public class Application implements WebMvcConfigurer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);

View File

@ -1,62 +1,66 @@
package org.baeldung.web.service;
import static io.restassured.RestAssured.given;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsCollectionContaining.hasItems;
import static org.hamcrest.core.IsEqual.equalTo;
import org.apache.commons.lang3.RandomStringUtils;
import org.baeldung.web.main.Application;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.junit4.SpringRunner;
import static io.restassured.RestAssured.given;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsCollectionContaining.hasItems;
import static org.hamcrest.core.IsEqual.equalTo;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT)
public class StudentServiceIntegrationTest {
@LocalServerPort
int port;
private static final String ENDPOINT = "http://localhost:8080/student/get";
private static final String ENDPOINT = "http://localhost:%s/student/get";
@Test
public void givenRequestForStudents_whenPageIsOne_expectContainsNames() {
given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat()
given().params("page", "0", "size", "2").get(String.format(ENDPOINT, port)).then().assertThat()
.body("content.name", hasItems("Bryan", "Ben"));
}
@Test
public void givenRequestForStudents_whenSizeIsTwo_expectTwoItems() {
given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat().body("size", equalTo(2));
given().params("page", "0", "size", "2").get(String.format(ENDPOINT, port)).then().assertThat().body("size", equalTo(2));
}
@Test
public void givenRequestForStudents_whenSizeIsTwo_expectNumberOfElementsTwo() {
given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat().body("numberOfElements", equalTo(2));
given().params("page", "0", "size", "2").get(String.format(ENDPOINT, port)).then().assertThat().body("numberOfElements", equalTo(2));
}
@Test
public void givenRequestForStudents_whenResourcesAreRetrievedPaged_thenExpect200() {
given().params("page", "0", "size", "2").get(ENDPOINT).then().statusCode(200);
given().params("page", "0", "size", "2").get(String.format(ENDPOINT, port)).then().statusCode(200);
}
@Test
public void givenRequestForStudents_whenPageOfResourcesAreRetrievedOutOfBounds_thenExpect500() {
given().params("page", "1000", "size", "2").get(ENDPOINT).then().statusCode(500);
given().params("page", "1000", "size", "2").get(String.format(ENDPOINT, port)).then().statusCode(500);
}
@Test
public void givenRequestForStudents_whenPageNotValid_thenExpect500() {
given().params("page", RandomStringUtils.randomNumeric(5), "size", "2").get(ENDPOINT).then().statusCode(500);
given().params("page", RandomStringUtils.randomNumeric(5), "size", "2").get(String.format(ENDPOINT, port)).then().statusCode(500);
}
@Test
public void givenRequestForStudents_whenPageSizeIsFive_expectFiveItems() {
given().params("page", "0", "size", "5").get(ENDPOINT).then().body("content.size()", is(5));
given().params("page", "0", "size", "5").get(String.format(ENDPOINT, port)).then().body("content.size()", is(5));
}
@Test
public void givenResourcesExist_whenFirstPageIsRetrieved_thenPageContainsResources() {
given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat().body("first", equalTo(true));
given().params("page", "0", "size", "2").get(String.format(ENDPOINT, port)).then().assertThat().body("first", equalTo(true));
}
}

View File

@ -7,10 +7,10 @@
<packaging>war</packaging>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -8,10 +8,10 @@
<description>A simple project to demonstrate Spring REST Shell features.</description>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -8,10 +8,10 @@
<packaging>war</packaging>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -8,10 +8,10 @@
<packaging>jar</packaging>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -7,10 +7,10 @@
<packaging>war</packaging>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -43,7 +43,7 @@ public class EmployeeClient
ResponseEntity<List<Employee>> response =
restTemplate.exchange(
"http://localhost:8080/spring-rest/employees/",
"http://localhost:8082/spring-rest/employees/",
HttpMethod.GET,
null,
new ParameterizedTypeReference<List<Employee>>(){});
@ -61,7 +61,7 @@ public class EmployeeClient
EmployeeList response =
restTemplate.getForObject(
"http://localhost:8080/spring-rest/employees/v2",
"http://localhost:8082/spring-rest/employees/v2",
EmployeeList.class);
List<Employee> employees = response.getEmployees();
@ -80,7 +80,7 @@ public class EmployeeClient
newEmployees.add(new Employee(4, "CEO"));
restTemplate.postForObject(
"http://localhost:8080/spring-rest/employees/",
"http://localhost:8082/spring-rest/employees/",
newEmployees,
ResponseEntity.class);
}
@ -94,7 +94,7 @@ public class EmployeeClient
newEmployees.add(new Employee(4, "CEO"));
restTemplate.postForObject(
"http://localhost:8080/spring-rest/employees/v2/",
"http://localhost:8082/spring-rest/employees/v2/",
new EmployeeList(newEmployees),
ResponseEntity.class);
}

View File

@ -1,13 +0,0 @@
package com.baeldung.sampleapp.web.controller.advice;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.AbstractJsonpResponseBodyAdvice;
@ControllerAdvice
public class JsonpControllerAdvice extends AbstractJsonpResponseBodyAdvice {
public JsonpControllerAdvice() {
super("callback");
}
}

View File

@ -9,9 +9,9 @@ import org.springframework.context.annotation.ComponentScan;
@EnableAutoConfiguration
@ComponentScan("com.baeldung.web.upload")
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
public class UploadApplication extends SpringBootServletInitializer {
public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(UploadApplication.class, args);
}
}

View File

@ -14,7 +14,7 @@ import com.baeldung.web.log.app.Application;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = { CustomApplication.class, ImageApplication.class, PropertyEditorApplication.class,
ResponseHeadersApplication.class, Application.class, com.baeldung.web.upload.app.Application.class,
ResponseHeadersApplication.class, Application.class, com.baeldung.web.upload.app.UploadApplication.class,
MainApplication.class})
public class SpringContextIntegrationTest {

View File

@ -8,10 +8,10 @@
<packaging>war</packaging>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -11,10 +11,10 @@
<description>Spring Security MVC Boot</description>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>
@ -36,7 +36,7 @@
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Private</title>
</head>

View File

@ -9,10 +9,10 @@
<description>Spring OpenID sample project</description>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -9,10 +9,10 @@
<packaging>pom</packaging>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<modules>
@ -24,7 +24,7 @@
<properties>
<rest-assured.version>3.1.0</rest-assured.version>
<oauth.version>2.3.3.RELEASE</oauth.version>
<oauth-auto.version>2.0.1.RELEASE</oauth-auto.version>
<oauth-auto.version>2.1.1.RELEASE</oauth-auto.version>
</properties>
</project>

View File

@ -37,7 +37,7 @@
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
</dependencies>

View File

@ -38,7 +38,7 @@
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
</dependencies>

View File

@ -11,10 +11,10 @@
<description>Spring Security with Thymeleaf tutorial</description>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>
@ -43,7 +43,7 @@
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
</dependencies>

View File

@ -15,10 +15,10 @@
</properties>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-boot-2.0-temp</relativePath>
<relativePath>../../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -13,10 +13,10 @@
<description>Spring Vault sample project</description>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>
@ -41,27 +41,8 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.vault.core.version>2.0.1.RELEASE</spring.vault.core.version>
<spring.vault.core.version>2.1.1.RELEASE</spring.vault.core.version>
</properties>
</project>

View File

@ -11,10 +11,10 @@
<description>Spring WebFlux AMQP Sample</description>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>

View File

@ -1,6 +1,6 @@
spring:
rabbitmq:
host: 192.168.99.100
host: localhost
port: 5672
username: guest
password: guest

View File

@ -10,10 +10,10 @@
<name>Vaadin</name>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencyManagement>

View File

@ -0,0 +1,2 @@
#Vaadin supports spring-boot 2.1 properly from V8 onwards (according to this comment https://github.com/vaadin/spring/issues/331#issuecomment-435128475)
spring.main.allow-bean-definition-overriding=true

View File

@ -7,10 +7,10 @@
<name>vavr</name>
<parent>
<artifactId>parent-boot-2.0-temp</artifactId>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2.0-temp</relativePath>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>