Skip to content

Commit bb530dc

Browse files
committed
Polishing (backported from master)
1 parent e4e2212 commit bb530dc

File tree

5 files changed

+89
-165
lines changed

5 files changed

+89
-165
lines changed

spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -224,8 +224,7 @@ public void testQueryNoPersonsSharedNotTransactional() {
224224
q.setFlushMode(FlushModeType.AUTO);
225225
List<Person> people = q.getResultList();
226226
assertThat(people.size()).isEqualTo(0);
227-
assertThatExceptionOfType(Exception.class).isThrownBy(() ->
228-
q.getSingleResult())
227+
assertThatExceptionOfType(Exception.class).isThrownBy(q::getSingleResult)
229228
.withMessageContaining("closed");
230229
// We would typically expect an IllegalStateException, but Hibernate throws a
231230
// PersistenceException. So we assert the contents of the exception message instead.

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestBodyAdvice.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ boolean supports(MethodParameter methodParameter, Type targetType,
5757
* @param targetType the target type, not necessarily the same as the method
5858
* parameter type, e.g. for {@code HttpEntity<String>}.
5959
* @param converterType the converter used to deserialize the body
60-
* @return the input request or a new instance, never {@code null}
60+
* @return the input request or a new instance (never {@code null})
6161
*/
6262
HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter,
6363
Type targetType, Class<? extends HttpMessageConverter<?>> converterType) throws IOException;
@@ -83,8 +83,8 @@ Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodParameter
8383
* @param targetType the target type, not necessarily the same as the method
8484
* parameter type, e.g. for {@code HttpEntity<String>}.
8585
* @param converterType the selected converter type
86-
* @return the value to use or {@code null} which may then raise an
87-
* {@code HttpMessageNotReadableException} if the argument is required.
86+
* @return the value to use, or {@code null} which may then raise an
87+
* {@code HttpMessageNotReadableException} if the argument is required
8888
*/
8989
@Nullable
9090
Object handleEmptyBody(@Nullable Object body, HttpInputMessage inputMessage, MethodParameter parameter,

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestBodyAdviceAdapter.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.web.servlet.mvc.method.annotation;
1718

1819
import java.io.IOException;
@@ -25,10 +26,10 @@
2526

2627
/**
2728
* A convenient starting point for implementing
28-
* {@link org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice
29-
* ResponseBodyAdvice} with default method implementations.
29+
* {@link org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
30+
* RequestBodyAdvice} with default method implementations.
3031
*
31-
* <p>Sub-classes are required to implement {@link #supports} to return true
32+
* <p>Subclasses are required to implement {@link #supports} to return true
3233
* depending on when the advice applies.
3334
*
3435
* @author Rossen Stoyanchev
@@ -41,8 +42,7 @@ public abstract class RequestBodyAdviceAdapter implements RequestBodyAdvice {
4142
*/
4243
@Override
4344
public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter,
44-
Type targetType, Class<? extends HttpMessageConverter<?>> converterType)
45-
throws IOException {
45+
Type targetType, Class<? extends HttpMessageConverter<?>> converterType) throws IOException {
4646

4747
return inputMessage;
4848
}
@@ -62,9 +62,8 @@ public Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodPa
6262
*/
6363
@Override
6464
@Nullable
65-
public Object handleEmptyBody(@Nullable Object body, HttpInputMessage inputMessage,
66-
MethodParameter parameter, Type targetType,
67-
Class<? extends HttpMessageConverter<?>> converterType) {
65+
public Object handleEmptyBody(@Nullable Object body, HttpInputMessage inputMessage, MethodParameter parameter,
66+
Type targetType, Class<? extends HttpMessageConverter<?>> converterType) {
6867

6968
return body;
7069
}

src/docs/asciidoc/core/core-appendix.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,9 @@ is a convenience mechanism that sets up a <<core.adoc#beans-factory-placeholderc
568568
This element activates the Spring infrastructure to detect annotations in bean classes:
569569

570570
* Spring's <<core.adoc#beans-factory-metadata, `@Configuration`>> model
571-
* <<core.adoc#beans-annotation-config, `@Autowired`/`@Inject`>> and `@Value`
572-
* JSR-250's `@Resource`, `@PostConstruct` and `@PreDestroy` (if available)
571+
* <<core.adoc#beans-annotation-config, `@Autowired`/`@Inject`>>, `@Value`, and `@Lookup`
572+
* JSR-250's `@Resource`, `@PostConstruct`, and `@PreDestroy` (if available)
573+
* JAX-WS's `@WebServiceRef` and EJB 3's `@EJB` (if available)
573574
* JPA's `@PersistenceContext` and `@PersistenceUnit` (if available)
574575
* Spring's <<core.adoc#context-functionality-events-annotation, `@EventListener`>>
575576

@@ -682,8 +683,7 @@ XML extension (a custom XML element) that lets us configure objects of the type
682683
`SimpleDateFormat` (from the `java.text` package). When we are done,
683684
we will be able to define bean definitions of type `SimpleDateFormat` as follows:
684685

685-
[source,xml,indent=0]
686-
[subs="verbatim,quotes"]
686+
[source,xml,indent=0,subs="verbatim,quotes"]
687687
----
688688
<myns:dateformat id="dateFormat"
689689
pattern="yyyy-MM-dd HH:mm"

0 commit comments

Comments
 (0)