diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java index 81d035b489..2a7ec72cee 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConverters.java @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import org.springframework.http.converter.FormHttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; import org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter; @@ -155,15 +156,14 @@ public class HttpMessageConverters implements Iterable> formConverter.setPartConverters(combinedConverters); } + @SuppressWarnings("unchecked") private List> extractPartConverters( - AllEncompassingFormHttpMessageConverter formConverter) { - Field field = ReflectionUtils.findField( - AllEncompassingFormHttpMessageConverter.class, "partConverters"); + FormHttpMessageConverter formConverter) { + Field field = ReflectionUtils.findField(FormHttpMessageConverter.class, + "partConverters"); ReflectionUtils.makeAccessible(field); - @SuppressWarnings("unchecked") - List> partConverters = (List>) ReflectionUtils - .getField(field, formConverter); - return partConverters; + return (List>) ReflectionUtils.getField(field, + formConverter); } /** diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java index 0cb355a098..155e758a3f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java @@ -172,14 +172,16 @@ public class BasicErrorControllerIntegrationTests { @SuppressWarnings("rawtypes") public void testRequestBodyValidationForMachineClient() throws Exception { load(); - RequestEntity request = RequestEntity.post(URI.create(createUrl("/bodyValidation"))) + RequestEntity request = RequestEntity + .post(URI.create(createUrl("/bodyValidation"))) .contentType(MediaType.APPLICATION_JSON).body("{}"); ResponseEntity entity = new TestRestTemplate().exchange(request, Map.class); String resp = entity.getBody().toString(); assertThat(resp, containsString("Error count: 1")); assertThat(resp, containsString("errors=[{")); assertThat(resp, containsString("codes=[")); - assertThat(resp, containsString("org.springframework.web.bind.MethodArgumentNotValidException")); + assertThat(resp, containsString( + "org.springframework.web.bind.MethodArgumentNotValidException")); } private void assertErrorAttributes(Map content, String status, String error, @@ -278,7 +280,7 @@ public class BasicErrorControllerIntegrationTests { } - private static class DummyBody { + static class DummyBody { @NotNull private String content; @@ -290,6 +292,7 @@ public class BasicErrorControllerIntegrationTests { public void setContent(String content) { this.content = content; } + } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java index 23b25269a9..7f5b91e95f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorAttributesTests.java @@ -168,7 +168,8 @@ public class DefaultErrorAttributesTests { } @Test - public void extractMethodArgumentNotValidExceptionBindingResultErrors() throws Exception { + public void extractMethodArgumentNotValidExceptionBindingResultErrors() + throws Exception { BindingResult bindingResult = new MapBindingResult( Collections.singletonMap("a", "b"), "objectName"); bindingResult.addError(new ObjectError("c", "d")); diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 9abb8fdeff..005bb2a884 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -634,8 +634,8 @@ Nested POJO properties can also be created (so a setter is not mandatory) if the default constructor, or a constructor accepting a single value that can be coerced from String. Some people use Project Lombok to add getters and setters automatically. -TIP: Contrary to `@Value`, SpEL expressions are not evaluated prior to injecting a value -in the relevant `@ConfigurationProperties` bean as said value is usually externalized. +NOTE: Contrary to `@Value`, SpEL expressions are not evaluated prior to injecting a value +in the relevant `@ConfigurationProperties` bean. The `@EnableConfigurationProperties` annotation is automatically applied to your project so that any beans annotated with `@ConfigurationProperties` will be configured from the @@ -962,7 +962,7 @@ NOTE: Logback does not have a `FATAL` level (it is mapped to `ERROR`) === Console output The default log configuration will echo messages to the console as they are written. By default `ERROR`, `WARN` and `INFO` level messages are logged. You can also enable a -"debug" mode by starting your application with a `--debug` flag. +"`debug`" mode by starting your application with a `--debug` flag. [indent=0] ---- @@ -972,8 +972,8 @@ default `ERROR`, `WARN` and `INFO` level messages are logged. You can also enabl NOTE: you can also specify `debug=true` in your `application.properties`. When the debug mode is enabled, a selection of core loggers (embedded container, Hibernate -and Spring) are configured to output more information. In other words, enabling the debug -mode does not configure your application log messages with `DEBUG` level. +and Spring) are configured to output more information. Enabling the debug mode does _not_ +configure your application log all messages with `DEBUG` level. If your terminal supports ANSI, color output will be used to aid readability. You can set `spring.output.ansi.enabled` to a @@ -1452,7 +1452,6 @@ particular controller and/or exception type. [source,java,indent=0,subs="verbatim,quotes,attributes"] ---- - @ControllerAdvice(basePackageClasses = FooController.class) public class FooControllerAdvice extends ResponseEntityExceptionHandler { @@ -1474,9 +1473,9 @@ particular controller and/or exception type. } ---- -In the example above, if `YourException` is thrown by a controller defined in the same package -as `FooController`, a json representation of the `CustomerErrorType` POJO will be used instead -of the `ErrorAttributes` representation. +In the example above, if `YourException` is thrown by a controller defined in the same +package as `FooController`, a json representation of the `CustomerErrorType` POJO will be +used instead of the `ErrorAttributes` representation. If you want more specific error pages for some conditions, the embedded servlet containers support a uniform Java DSL for customizing the error handling. Assuming that you have a