Skip to content

Commit b286e14

Browse files
committed
[BAEL-10234] - Move spring-rest-... modules to Boot 2
1 parent c5d3953 commit b286e14

10 files changed

Lines changed: 34 additions & 28 deletions

File tree

‎spring-rest-angular/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
<packaging>war</packaging>
99

1010
<parent>
11-
<artifactId>parent-boot-1</artifactId>
11+
<artifactId>parent-boot-2</artifactId>
1212
<groupId>com.baeldung</groupId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../parent-boot-1</relativePath>
14+
<relativePath>../parent-boot-2</relativePath>
1515
</parent>
1616

1717
<dependencies>

‎spring-rest-query-language/pom.xml‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
<packaging>war</packaging>
99

1010
<parent>
11-
<artifactId>parent-boot-1</artifactId>
11+
<artifactId>parent-boot-2</artifactId>
1212
<groupId>com.baeldung</groupId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../parent-boot-1</relativePath>
14+
<relativePath>../parent-boot-2</relativePath>
1515
</parent>
1616

1717
<dependencies>
@@ -149,6 +149,7 @@
149149
<dependency>
150150
<groupId>org.javassist</groupId>
151151
<artifactId>javassist</artifactId>
152+
<version>${javassist.version}</version>
152153
</dependency>
153154
<dependency>
154155
<groupId>mysql</groupId>
@@ -349,11 +350,12 @@
349350

350351
<!-- various -->
351352
<xstream.version>1.4.9</xstream.version>
352-
353+
<javassist.version>3.21.0-GA</javassist.version>
354+
353355
<!-- util -->
354356
<guava.version>19.0</guava.version>
355357
<commons-lang3.version>3.5</commons-lang3.version>
356-
358+
357359
<!-- Maven plugins -->
358360
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
359361
<apt-maven-plugin.version>1.1.3</apt-maven-plugin.version>

‎spring-rest-query-language/src/main/java/org/baeldung/persistence/dao/MyUserRepository.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package org.baeldung.persistence.dao;
22

3-
import com.querydsl.core.types.dsl.StringExpression;
43
import org.baeldung.persistence.model.MyUser;
54
import org.baeldung.persistence.model.QMyUser;
65
import org.springframework.data.jpa.repository.JpaRepository;
7-
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
6+
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
87
import org.springframework.data.querydsl.binding.QuerydslBinderCustomizer;
98
import org.springframework.data.querydsl.binding.QuerydslBindings;
9+
import org.springframework.data.querydsl.binding.SingleValueBinding;
1010

11+
import com.querydsl.core.types.dsl.StringExpression;
1112
import com.querydsl.core.types.dsl.StringPath;
12-
import org.springframework.data.querydsl.binding.SingleValueBinding;
1313

14-
public interface MyUserRepository extends JpaRepository<MyUser, Long>, QueryDslPredicateExecutor<MyUser>, QuerydslBinderCustomizer<QMyUser> {
14+
public interface MyUserRepository extends JpaRepository<MyUser, Long>, QuerydslPredicateExecutor<MyUser>, QuerydslBinderCustomizer<QMyUser> {
1515
@Override
1616
default public void customize(final QuerydslBindings bindings, final QMyUser root) {
1717
bindings.bind(String.class)

‎spring-rest-query-language/src/main/java/org/baeldung/spring/Application.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
88
import org.springframework.boot.autoconfigure.SpringBootApplication;
99
import org.springframework.boot.builder.SpringApplicationBuilder;
10-
import org.springframework.boot.web.support.SpringBootServletInitializer;
10+
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
1111
import org.springframework.context.annotation.ComponentScan;
1212
import org.springframework.scheduling.annotation.EnableScheduling;
1313
import org.springframework.web.context.request.RequestContextListener;

‎spring-rest-shell/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
<description>A simple project to demonstrate Spring REST Shell features.</description>
99

1010
<parent>
11-
<artifactId>parent-boot-1</artifactId>
11+
<artifactId>parent-boot-2</artifactId>
1212
<groupId>com.baeldung</groupId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../parent-boot-1</relativePath>
14+
<relativePath>../parent-boot-2</relativePath>
1515
</parent>
1616

1717
<dependencies>

‎spring-rest-simple/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
<packaging>war</packaging>
99

1010
<parent>
11-
<artifactId>parent-boot-1</artifactId>
11+
<artifactId>parent-boot-2</artifactId>
1212
<groupId>com.baeldung</groupId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../parent-boot-1</relativePath>
14+
<relativePath>../parent-boot-2</relativePath>
1515
</parent>
1616

1717
<dependencies>

‎spring-rest-simple/src/main/java/org/baeldung/config/Application.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
55
import org.springframework.boot.autoconfigure.SpringBootApplication;
6-
import org.springframework.boot.web.support.SpringBootServletInitializer;
6+
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
77
import org.springframework.context.annotation.ComponentScan;
88

99
@EnableAutoConfiguration

‎spring-rest-simple/src/main/java/org/baeldung/config/WebConfig.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import org.springframework.oxm.xstream.XStreamMarshaller;
1515
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
1616
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
17-
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
17+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
1818

1919
import java.text.SimpleDateFormat;
2020
import java.util.List;
@@ -25,7 +25,7 @@
2525
@Configuration
2626
@EnableWebMvc
2727
@ComponentScan({ "org.baeldung.web" })
28-
public class WebConfig extends WebMvcConfigurerAdapter {
28+
public class WebConfig implements WebMvcConfigurer {
2929

3030
public WebConfig() {
3131
super();
@@ -48,7 +48,6 @@ public void configureMessageConverters(final List<HttpMessageConverter<?>> messa
4848
messageConverters.add(new ProtobufHttpMessageConverter());
4949
messageConverters.add(new KryoHttpMessageConverter());
5050
messageConverters.add(new StringHttpMessageConverter());
51-
super.configureMessageConverters(messageConverters);
5251
}
5352

5453
private HttpMessageConverter<Object> createXmlHttpMessageConverter() {

‎spring-resttemplate/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
<packaging>war</packaging>
99

1010
<parent>
11-
<artifactId>parent-boot-1</artifactId>
11+
<artifactId>parent-boot-2</artifactId>
1212
<groupId>com.baeldung</groupId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../parent-boot-1</relativePath>
14+
<relativePath>../parent-boot-2</relativePath>
1515
</parent>
1616

1717
<dependencies>

‎spring-resttemplate/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package org.baeldung.client;
22

3-
import okhttp3.Request;
4-
import okhttp3.RequestBody;
3+
import static org.hamcrest.CoreMatchers.equalTo;
4+
import static org.hamcrest.MatcherAssert.assertThat;
5+
import static org.junit.Assert.assertTrue;
6+
57
import org.junit.Before;
68
import org.junit.Test;
79
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -12,9 +14,8 @@
1214
import org.springframework.http.ResponseEntity;
1315
import org.springframework.web.client.RestTemplate;
1416

15-
import static org.hamcrest.CoreMatchers.equalTo;
16-
import static org.hamcrest.MatcherAssert.assertThat;
17-
import static org.junit.Assert.assertTrue;
17+
import okhttp3.Request;
18+
import okhttp3.RequestBody;
1819

1920
public class TestRestTemplateBasicLiveTest {
2021

@@ -39,7 +40,9 @@ public void givenTestRestTemplate_whenSendGetForEntity_thenStatusOk() {
3940

4041
@Test
4142
public void givenRestTemplateWrapper_whenSendGetForEntity_thenStatusOk() {
42-
TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplate);
43+
RestTemplateBuilder restTemplateBuilder = new RestTemplateBuilder();
44+
restTemplateBuilder.configure(restTemplate);
45+
TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplateBuilder);
4346
ResponseEntity<String> response = testRestTemplate.getForEntity(FOO_RESOURCE_URL + "/1", String.class);
4447
assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
4548
}
@@ -55,7 +58,9 @@ public void givenRestTemplateBuilderWrapper_whenSendGetForEntity_thenStatusOk()
5558

5659
@Test
5760
public void givenRestTemplateWrapperWithCredentials_whenSendGetForEntity_thenStatusOk() {
58-
TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplate, "user", "passwd");
61+
RestTemplateBuilder restTemplateBuilder = new RestTemplateBuilder().basicAuthentication("user", "passwd");
62+
restTemplateBuilder.configure(restTemplate);
63+
TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplateBuilder);
5964
ResponseEntity<String> response = testRestTemplate.getForEntity(URL_SECURED_BY_AUTHENTICATION,
6065
String.class);
6166
assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));

0 commit comments

Comments
 (0)