diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml
index ec4b50bfa8..9bb3c12945 100644
--- a/spring-rest/pom.xml
+++ b/spring-rest/pom.xml
@@ -10,7 +10,7 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.2.RELEASE
+ 1.4.3.RELEASE
@@ -343,7 +343,7 @@
3.1.0
3.5
1.4.9
-
+
20.0
2.9.0
diff --git a/spring-rest/src/main/java/org/baeldung/config/WebConfig.java b/spring-rest/src/main/java/org/baeldung/config/WebConfig.java
index 39c1252c4f..d04214c377 100644
--- a/spring-rest/src/main/java/org/baeldung/config/WebConfig.java
+++ b/spring-rest/src/main/java/org/baeldung/config/WebConfig.java
@@ -35,10 +35,10 @@ public class WebConfig extends WebMvcConfigurerAdapter {
builder.indentOutput(true).dateFormat(new SimpleDateFormat("dd-MM-yyyy hh:mm"));
messageConverters.add(new MappingJackson2HttpMessageConverter(builder.build()));
// messageConverters.add(new MappingJackson2XmlHttpMessageConverter(builder.createXmlMapper(true).build()));
-
+
// messageConverters.add(createXmlHttpMessageConverter());
// messageConverters.add(new MappingJackson2HttpMessageConverter());
-
+
messageConverters.add(new ProtobufHttpMessageConverter());
messageConverters.add(new KryoHttpMessageConverter());
super.configureMessageConverters(messageConverters);
diff --git a/spring-rest/src/main/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeController.java b/spring-rest/src/main/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeController.java
index d5a64babfe..9ad687d758 100644
--- a/spring-rest/src/main/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeController.java
+++ b/spring-rest/src/main/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeController.java
@@ -1,6 +1,5 @@
package org.baeldung.web.controller.mediatypes;
-
import org.baeldung.web.dto.BaeldungItem;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -9,12 +8,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@RequestMapping(value = "/", produces = "application/vnd.baeldung.api.v1+json",
- consumes = "application/vnd.baeldung.api.v1+json")
+@RequestMapping(value = "/", produces = "application/vnd.baeldung.api.v1+json", consumes = "application/vnd.baeldung.api.v1+json")
public class CustomMediaTypeController {
- @RequestMapping(value = "/public/api/endpoint", produces = "application/vnd.baeldung.api.v1+json",
- consumes = "application/vnd.baeldung.api.v1+json")
+ @RequestMapping(value = "/public/api/endpoint", produces = "application/vnd.baeldung.api.v1+json", consumes = "application/vnd.baeldung.api.v1+json")
public @ResponseBody ResponseEntity getItem() {
return new ResponseEntity<>(new BaeldungItem("itemId1"), HttpStatus.OK);
}
diff --git a/spring-rest/src/main/java/org/baeldung/web/dto/BaeldungItem.java b/spring-rest/src/main/java/org/baeldung/web/dto/BaeldungItem.java
index 9053395302..9b3ecd33b9 100644
--- a/spring-rest/src/main/java/org/baeldung/web/dto/BaeldungItem.java
+++ b/spring-rest/src/main/java/org/baeldung/web/dto/BaeldungItem.java
@@ -1,6 +1,5 @@
package org.baeldung.web.dto;
-
public class BaeldungItem {
private final String itemId;
diff --git a/spring-rest/src/test/java/org/baeldung/okhttp/DefaultContentTypeInterceptor.java b/spring-rest/src/test/java/org/baeldung/okhttp/DefaultContentTypeInterceptor.java
index 2a33a1febd..f49d7668e8 100644
--- a/spring-rest/src/test/java/org/baeldung/okhttp/DefaultContentTypeInterceptor.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/DefaultContentTypeInterceptor.java
@@ -17,9 +17,7 @@ public class DefaultContentTypeInterceptor implements Interceptor {
public Response intercept(Interceptor.Chain chain) throws IOException {
Request originalRequest = chain.request();
- Request requestWithUserAgent = originalRequest.newBuilder()
- .header("Content-Type", contentType)
- .build();
+ Request requestWithUserAgent = originalRequest.newBuilder().header("Content-Type", contentType).build();
return chain.proceed(requestWithUserAgent);
}
diff --git a/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpHeaderLiveTest.java b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpHeaderLiveTest.java
index 8888f7d4a7..c3dddc69e1 100644
--- a/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpHeaderLiveTest.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpHeaderLiveTest.java
@@ -19,15 +19,12 @@ public class OkHttpHeaderLiveTest {
@Before
public void init() {
- client = new OkHttpClient();
+ client = new OkHttpClient();
}
@Test
public void whenSetHeader_thenCorrect() throws IOException {
- Request request = new Request.Builder()
- .url(SAMPLE_URL)
- .addHeader("Content-Type", "application/json")
- .build();
+ Request request = new Request.Builder().url(SAMPLE_URL).addHeader("Content-Type", "application/json").build();
Call call = client.newCall(request);
Response response = call.execute();
@@ -37,13 +34,9 @@ public class OkHttpHeaderLiveTest {
@Test
public void whenSetDefaultHeader_thenCorrect() throws IOException {
- OkHttpClient clientWithInterceptor = new OkHttpClient.Builder()
- .addInterceptor(new DefaultContentTypeInterceptor("application/json"))
- .build();
+ OkHttpClient clientWithInterceptor = new OkHttpClient.Builder().addInterceptor(new DefaultContentTypeInterceptor("application/json")).build();
- Request request = new Request.Builder()
- .url(SAMPLE_URL)
- .build();
+ Request request = new Request.Builder().url(SAMPLE_URL).build();
Call call = clientWithInterceptor.newCall(request);
Response response = call.execute();
diff --git a/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpPostingLiveTest.java b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpPostingLiveTest.java
index 9f9220329d..d681a56822 100644
--- a/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpPostingLiveTest.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpPostingLiveTest.java
@@ -49,11 +49,7 @@ public class OkHttpPostingLiveTest {
public void whenSendPostRequestWithAuthorization_thenCorrect() throws IOException {
final String postBody = "test post";
- final Request request = new Request.Builder()
- .url(URL_SECURED_BY_BASIC_AUTHENTICATION)
- .addHeader("Authorization", Credentials.basic("test", "test"))
- .post(RequestBody.create(MediaType.parse("text/x-markdown; charset=utf-8"), "test post"))
- .build();
+ final Request request = new Request.Builder().url(URL_SECURED_BY_BASIC_AUTHENTICATION).addHeader("Authorization", Credentials.basic("test", "test")).post(RequestBody.create(MediaType.parse("text/x-markdown; charset=utf-8"), "test post")).build();
final Call call = client.newCall(request);
final Response response = call.execute();
diff --git a/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpRedirectLiveTest.java b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpRedirectLiveTest.java
index d568a4fdf7..e3f567a693 100644
--- a/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpRedirectLiveTest.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/OkHttpRedirectLiveTest.java
@@ -17,13 +17,9 @@ public class OkHttpRedirectLiveTest {
@Test
public void whenSetFollowRedirects_thenNotRedirected() throws IOException {
- OkHttpClient client = new OkHttpClient().newBuilder()
- .followRedirects(false)
- .build();
+ OkHttpClient client = new OkHttpClient().newBuilder().followRedirects(false).build();
- Request request = new Request.Builder()
- .url("http://t.co/I5YYd9tddw")
- .build();
+ Request request = new Request.Builder().url("http://t.co/I5YYd9tddw").build();
Call call = client.newCall(request);
Response response = call.execute();
diff --git a/spring-rest/src/test/java/org/baeldung/okhttp/ProgressRequestWrapper.java b/spring-rest/src/test/java/org/baeldung/okhttp/ProgressRequestWrapper.java
index 255d10b98a..04a2fcc6e7 100644
--- a/spring-rest/src/test/java/org/baeldung/okhttp/ProgressRequestWrapper.java
+++ b/spring-rest/src/test/java/org/baeldung/okhttp/ProgressRequestWrapper.java
@@ -71,4 +71,3 @@ public class ProgressRequestWrapper extends RequestBody {
}
}
-
diff --git a/spring-rest/src/test/java/org/baeldung/uribuilder/SpringUriBuilderTest.java b/spring-rest/src/test/java/org/baeldung/uribuilder/SpringUriBuilderTest.java
index 4b6a9ba312..84ae1063d9 100644
--- a/spring-rest/src/test/java/org/baeldung/uribuilder/SpringUriBuilderTest.java
+++ b/spring-rest/src/test/java/org/baeldung/uribuilder/SpringUriBuilderTest.java
@@ -10,44 +10,40 @@ import org.springframework.web.util.UriComponentsBuilder;
public class SpringUriBuilderTest {
- @Test
- public void constructUri() {
- UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.baeldung.com")
- .path("/junit-5").build();
+ @Test
+ public void constructUri() {
+ UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.baeldung.com").path("/junit-5").build();
- assertEquals("http://www.baeldung.com/junit-5", uriComponents.toUriString());
- }
+ assertEquals("http://www.baeldung.com/junit-5", uriComponents.toUriString());
+ }
- @Test
- public void constructUriEncoded() {
- UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.baeldung.com")
- .path("/junit 5").build().encode();
+ @Test
+ public void constructUriEncoded() {
+ UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.baeldung.com").path("/junit 5").build().encode();
- assertEquals("http://www.baeldung.com/junit%205", uriComponents.toUriString());
- }
+ assertEquals("http://www.baeldung.com/junit%205", uriComponents.toUriString());
+ }
- @Test
- public void constructUriFromTemplate() {
- UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.baeldung.com")
- .path("/{article-name}").buildAndExpand("junit-5");
+ @Test
+ public void constructUriFromTemplate() {
+ UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.baeldung.com").path("/{article-name}").buildAndExpand("junit-5");
- assertEquals("http://www.baeldung.com/junit-5", uriComponents.toUriString());
- }
+ assertEquals("http://www.baeldung.com/junit-5", uriComponents.toUriString());
+ }
- @Test
- public void constructUriWithQueryParameter() {
- UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.google.com")
- .path("/").query("q={keyword}").buildAndExpand("baeldung");
+ @Test
+ public void constructUriWithQueryParameter() {
+ UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.google.com").path("/").query("q={keyword}").buildAndExpand("baeldung");
- assertEquals("http://www.google.com/?q=baeldung", uriComponents.toUriString());
- }
-
- @Test
- public void expandWithRegexVar() {
- String template = "/myurl/{name:[a-z]{1,5}}/show";
- UriComponents uriComponents = UriComponentsBuilder.fromUriString(template).build();
- uriComponents = uriComponents.expand(Collections.singletonMap("name", "test"));
-
- assertEquals("/myurl/test/show", uriComponents.getPath());
- }
+ assertEquals("http://www.google.com/?q=baeldung", uriComponents.toUriString());
+ }
+
+ @Test
+ public void expandWithRegexVar() {
+ String template = "/myurl/{name:[a-z]{1,5}}/show";
+ UriComponents uriComponents = UriComponentsBuilder.fromUriString(template).build();
+ uriComponents = uriComponents.expand(Collections.singletonMap("name", "test"));
+
+ assertEquals("/myurl/test/show", uriComponents.getPath());
+ }
}
diff --git a/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeControllerTest.java b/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeControllerTest.java
index 5b494cac34..a0a51e935d 100644
--- a/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeControllerTest.java
+++ b/spring-rest/src/test/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeControllerTest.java
@@ -15,7 +15,6 @@ import org.springframework.web.context.WebApplicationContext;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = WebConfig.class)
@WebAppConfiguration
@@ -33,9 +32,6 @@ public class CustomMediaTypeControllerTest {
@Test
public void shouldSendRequestForItem() throws Exception {
- mockMvc.perform(get("/public/api/endpoint")
- .contentType("application/vnd.baeldung.api.v1+json")
- .accept("application/vnd.baeldung.api.v1+json"))
- .andExpect(status().isOk());
+ mockMvc.perform(get("/public/api/endpoint").contentType("application/vnd.baeldung.api.v1+json").accept("application/vnd.baeldung.api.v1+json")).andExpect(status().isOk());
}
}
\ No newline at end of file