migrated the following modules using parent-spring-5 to spring 5.1:

spring-mvc-simple
spring-security-mvc-custom
spring-security-mvc-login
spring-security-rest
spring-security-rest-basic-auth
spring-static-resources
spring-thymeleaf
This commit is contained in:
geroza 2019-01-08 16:16:51 -02:00
parent 3bad1ab7d3
commit c7ba38ffcd
16 changed files with 64 additions and 40 deletions

View File

@ -7,10 +7,10 @@
<name>ethereum</name>
<parent>
<artifactId>parent-spring-5</artifactId>
<artifactId>parent-spring-5-1</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-spring-5</relativePath>
<relativePath>../parent-spring-5-1</relativePath>
</parent>
<dependencies>

View File

@ -0,0 +1 @@
## Relevant articles:

39
parent-spring-5-1/pom.xml Normal file
View File

@ -0,0 +1,39 @@
<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>parent-spring-5-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parent-spring-5-1</name>
<description>Parent for all spring 5 core modules</description>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<spring.version>5.0.6.RELEASE</spring.version>
<junit.jupiter.version>5.0.2</junit.jupiter.version>
<jackson-databind.version>2.9.6</jackson-databind.version>
<jackson.version>2.9.6</jackson.version>
<spring-security.version>5.0.6.RELEASE</spring-security.version>
</properties>
</project>

View File

@ -29,11 +29,11 @@
</dependencies>
<properties>
<spring.version>5.0.6.RELEASE</spring.version>
<spring.version>5.1.2.RELEASE</spring.version>
<junit.jupiter.version>5.0.2</junit.jupiter.version>
<jackson-databind.version>2.9.6</jackson-databind.version>
<jackson.version>2.9.6</jackson.version>
<spring-security.version>5.0.6.RELEASE</spring-security.version>
<spring-security.version>5.1.2.RELEASE</spring-security.version>
</properties>
</project>

View File

@ -9,9 +9,9 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-spring-5</artifactId>
<artifactId>parent-spring-5-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-spring-5</relativePath>
<relativePath>../../parent-spring-5-1</relativePath>
</parent>
<dependencies>

View File

@ -6,9 +6,9 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-spring-5</artifactId>
<artifactId>parent-spring-5-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-spring-5</relativePath>
<relativePath>../../parent-spring-5-1</relativePath>
</parent>
<dependencies>
@ -99,7 +99,6 @@
<org.springframework.data.version>2.1.2.RELEASE</org.springframework.data.version>
<querydsl.version>4.1.4</querydsl.version>
<mysema.maven.version>1.1.3</mysema.maven.version>
<spring.version>5.1.0.RELEASE</spring.version>
<mongodb-reactivestreams.version>1.9.2</mongodb-reactivestreams.version>
<projectreactor.version>3.2.0.RELEASE</projectreactor.version>

View File

@ -329,6 +329,7 @@
<module>parent-boot-2</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-spring-5-1</module>
<module>parent-java</module>
<module>parent-kotlin</module>
@ -600,6 +601,7 @@
<module>parent-boot-2</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-spring-5-1</module>
<module>parent-java</module>
<module>parent-kotlin</module>
@ -993,6 +995,7 @@
<module>parent-boot-2</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-spring-5-1</module>
<module>parent-java</module>
<module>parent-kotlin</module>
@ -1045,6 +1048,7 @@
<module>parent-boot-2</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-spring-5-1</module>
<module>parent-java</module>
<module>parent-kotlin</module>
@ -1312,6 +1316,7 @@
<module>parent-boot-2</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-spring-5-1</module>
<module>parent-java</module>
<module>parent-kotlin</module>
@ -1544,6 +1549,7 @@
<module>parent-boot-2</module>
<module>parent-spring-4</module>
<module>parent-spring-5</module>
<module>parent-spring-5-1</module>
<module>parent-java</module>
<module>parent-kotlin</module>

View File

@ -10,9 +10,9 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-spring-5</artifactId>
<artifactId>parent-spring-5-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-spring-5</relativePath>
<relativePath>../parent-spring-5-1</relativePath>
</parent>
<dependencies>

View File

@ -11,9 +11,9 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-spring-5</artifactId>
<artifactId>parent-spring-5-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-spring-5</relativePath>
<relativePath>../parent-spring-5-1</relativePath>
</parent>
<dependencies>

View File

@ -8,10 +8,10 @@
<packaging>war</packaging>
<parent>
<artifactId>parent-spring-5</artifactId>
<artifactId>parent-spring-5-1</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-spring-5</relativePath>
<relativePath>../parent-spring-5-1</relativePath>
</parent>
<dependencies>

View File

@ -154,25 +154,6 @@
<outputDirectory>${deploy-path}</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<executions>
<execution>
<id>default-test</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit.platform.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<finalName>spring-mvc-simple</finalName>

View File

@ -1,7 +1,6 @@
package com.baeldung.spring;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

View File

@ -4,7 +4,7 @@ import org.apache.http.HttpHost;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.support.BasicAuthorizationInterceptor;
import org.springframework.http.client.support.BasicAuthenticationInterceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
@ -38,7 +38,7 @@ public class RestTemplateFactory implements FactoryBean<RestTemplate>, Initializ
HttpHost host = new HttpHost("localhost", 8082, "http");
final ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactoryBasicAuth(host);
restTemplate = new RestTemplate(requestFactory);
restTemplate.getInterceptors().add(new BasicAuthorizationInterceptor("user1", "user1Pass"));
restTemplate.getInterceptors().add(new BasicAuthenticationInterceptor("user1", "user1Pass"));
}
}

View File

@ -8,7 +8,6 @@ import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@EnableWebMvc

View File

@ -6,7 +6,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({ "/WebSecurityConfig.xml" })
@ContextConfiguration({ "/webSecurityConfig.xml" })
public class SpringContextIntegrationTest {
@Test

View File

@ -29,7 +29,7 @@ public class FooLiveTest {
// }
// return RestAssured.given().cookie("JSESSIONID", cookie);
return RestAssured.given()
.auth()
.auth().preemptive()
.basic("user", "userPass");
}