Commit Graph

20876 Commits

Author SHA1 Message Date
Juergen Hoeller 589060d10f Avoid LinkedList performance issues through use of ArrayDeque
Closes gh-25652
2020-08-27 14:14:08 +02:00
Juergen Hoeller 60fa704f78 Consistent behavior for overloaded @Bean methods with ASM processing
Closes gh-25263
2020-08-27 14:13:33 +02:00
Juergen Hoeller f43c39c905 Upgrade to Hibernate ORM 5.4.20 2020-08-25 16:17:35 +02:00
Juergen Hoeller 6f0461c569 Polishing 2020-08-25 16:17:22 +02:00
Juergen Hoeller 04df9b8f49 Efficient checks for empty strings and single character matches
Closes gh-25552
Closes gh-25553
2020-08-25 16:17:12 +02:00
Juergen Hoeller 0d4040aa63 Avoid potential integer overflow in seconds->millis transformation
Closes gh-25613
2020-08-25 16:16:34 +02:00
Sam Brannen 148dc95eb1 Fix regressions in SimpleThreadScope and SimpleTransactionScope
PR gh-25038 introduced regressions in SimpleThreadScope and
SimpleTransactionScope in Spring Framework 5.2.7. Specifically, if a
thread-scoped or transaction-scoped bean has a dependency on another
thread-scoped or transaction-scoped bean, respectively, a
ConcurrentModificationException will be thrown on Java 11 or higher.

The reason is that Java 11 introduced a check for concurrent
modification in java.util.HashMap's computeIfAbsent() implementation,
and such a modification can occur when a thread-scoped bean is being
created in order to satisfy a dependency of another thread-scoped bean
that is currently being created.

This commit fixes these regressions by switching from HashMap to
ConcurrentHashMap for the instance maps in SimpleThreadScope and
SimpleTransactionScope.

Closes gh-25618
2020-08-22 23:19:58 +02:00
Sam Brannen d939016a09 Polish contribution
See gh-25600
2020-08-17 15:53:45 +02:00
Maciej Miklas a83529c844 Introduce createContext() factory method in AbstractGenericContextLoader
Prior to this commit it was possible to configure the
DefaultListableBeanFactory used by the GenericApplicationContext
created by AbstractGenericContextLoader, but it was not possible to
completely replace the bean factory.

This commit introduces a new createContext() factory method in
AbstractGenericContextLoader which indirectly allows subclasses to
supply a custom DefaultListableBeanFactory implementation to the
GenericApplicationContext.

Closes gh-25600
2020-08-17 15:38:24 +02:00
Sam Brannen 32e851617e Fix Javadoc formatting in GenericGroovyXmlContextLoader 2020-08-17 15:37:51 +02:00
Sam Brannen 93e5214d01 Revise Javadoc regarding log level for non-static BFPP @Bean method
Closes gh-25590
2020-08-16 20:03:46 +02:00
Juergen Hoeller 9bf5cba3c2 Drop outdated notes on handler type versus handler method restrictions
Closes gh-25482
2020-08-10 14:43:27 +02:00
Juergen Hoeller 7d56c303a4 Use getType with allowFactoryBeanInit=false during advisor retrieval
Closes gh-25546
2020-08-10 14:43:02 +02:00
Sam Brannen bd65762582 Polish Javadoc for MessagePostProcessor interfaces
See gh-25571
2020-08-10 11:26:41 +02:00
Philippe Marschall 6a7e58ac82 Add @FunctionalInterface to MessagePostProcessor
Add the @FunctionalInterface annotation to the MessagePostProcessor
interfaces in the spring-jms and spring-messaging projects.

Closes gh-25571
2020-08-10 11:19:35 +02:00
Sam Brannen e25e690ad4 Assert preconditions for MergedAnnotations.from() factory methods
Prior to this commit, if null values were supplied for the
RepeatableContainers or AnnotationFilter arguments to `from()` factory
methods in MergedAnnotations, certain operations would eventually
result in a NullPointerException. This is to be expected; however, the
NullPointerException is often swallowed and only logged at INFO level
with an exception message similar to the following.

> Failed to introspect annotations on org.example.MyClass: NullPointerException

In such cases, the INFO log message is not helpful in diagnosing the
problem. Furthermore, since the exception is swallowed, the desired
operation (e.g., MergedAnnotations.stream(...)) simply returns no
results.

This commit improves the user experience by eagerly asserting non-null
preconditions for required arguments in MergedAnnotations.from()
factory methods.

Closes gh-25568
2020-08-08 12:21:15 +02:00
Sam Brannen a614abe17b Polish Javadoc for MergedAnnotations 2020-08-08 11:59:24 +02:00
Juergen Hoeller 292f581cdd Populate dependencies metadata for resolved target behind lazy dependency proxy
Closes gh-25562
2020-08-07 21:42:02 +02:00
Juergen Hoeller 686f5d4a5e Upgrade to Jackson 2.10.5 2020-08-07 15:55:10 +02:00
Juergen Hoeller 3b9558a269 Polishing 2020-08-07 15:51:33 +02:00
Juergen Hoeller 692c5f292d Polishing 2020-08-07 13:11:48 +02:00
Juergen Hoeller 7fdb33a105 Upgrade to Jetty 9.4.31, Groovy 2.5.13, Hibernate ORM 5.4.19, EclipseLink 2.7.7, Checkstyle 8.35 2020-08-07 13:03:28 +02:00
Juergen Hoeller 8dd285f877 Polishing 2020-08-07 13:02:43 +02:00
Juergen Hoeller 94eee6a32a Provide access to AbstractRoutingDataSource's resolved target DataSources
Closes gh-25544
2020-08-07 13:00:35 +02:00
Juergen Hoeller 96a4e1150e Avoid unnecessary computation of cleaned URL
Closes gh-25531
2020-08-07 12:59:41 +02:00
Stephane Nicoll 6acbc5093a Indicate caches should be initialized in SimpleCacheManager
Closes gh-22988
2020-08-07 11:01:39 +02:00
diguage 0501999e43 Fix comment syntax in xml examples
See gh-25537
2020-08-06 14:25:30 +02:00
Stephane Nicoll b6842730f7 Merge pull request #25539 from diguage
* pr/25539:
  Fix asciidoctor syntax for source

Closes gh-25539
2020-08-06 09:27:38 +02:00
diguage 5cb2cc2466 Fix asciidoctor syntax for source
See gh-25539
2020-08-06 09:27:09 +02:00
Sam Brannen 96da1ff9ea Support @RestControllerAdvice in Standalone MockMvc again
Since Spring Framework 5.2, @RestControllerAdvice registered with
MockMvc when using MockMvcBuilders.standaloneSetup() has no longer been
properly supported if annotation attributes were declared in the
@RestControllerAdvice annotation. Prior to 5.2, this was not an issue.

The cause for this regression is two-fold.

1. Commit 50c257794f refactored
   DefaultListableBeanFactory so that findAnnotationOnBean() supports
   merged annotations; however, that commit did not refactor
   StaticListableBeanFactory#findAnnotationOnBean() to support merged
   annotations.

2. Commit 978adbdae7 refactored
   ControllerAdviceBean so that a merged @ControllerAdvice annotation
   is only looked up via ApplicationContext#findAnnotationOnBean().

The latter relies on the fact that findAnnotationOnBean() supports
merged annotations (e.g., @RestControllerAdvice as a merged instance of
@ControllerAdvice). Behind the scenes, MockMvcBuilders.standaloneSetup()
creates a StubWebApplicationContext which internally uses a
StubBeanFactory which extends StaticListableBeanFactory. Consequently,
since the implementation of findAnnotationOnBean() in
StaticListableBeanFactory was not updated to support merged annotations
like it was in DefaultListableBeanFactory, we only see this regression
with the standalone MockMvc support and not with MockMvc support for an
existing WebApplicationContext or with standard Spring applications
using an ApplicationContext that uses DefaultListableBeanFactory.

This commit fixes this regression by supporting merged annotations in
StaticListableBeanFactory#findAnnotationOnBean() as well.

Closes gh-25520
2020-08-05 17:40:16 +02:00
Sam Brannen 40fc472c70 Polish ExceptionHandlerTests 2020-08-05 17:24:45 +02:00
Sam Brannen 7a31885ae5 Fix bug in StaticListableBeanFactory.isSingleton()
Prior to this commit, StaticListableBeanFactory.isSingleton() returned
false for singleton beans unless they were created by a FactoryBean.

StaticListableBeanFactory.isSingleton() now properly returns true for
all beans not created by a FactoryBean.

Closes gh-25522
2020-08-04 15:13:10 +02:00
Sam Brannen 91d1383e93 Use Spliterators.emptySpliterator() in TypeMappedAnnotations
For greater clarity, this commit invokes Spliterators.emptySpliterator()
directly instead of going through java.util.Collections.EmptyList.
2020-08-03 13:44:02 +02:00
Sam Brannen 969aa8ad47 Update copyright date 2020-08-03 12:19:21 +02:00
Sam Brannen 482adb9478 Fix error message for type mismatch in jsonPath().value()
Prior to this commit, if a value existed at the specified JSON path but
had an incompatible type, the AssertionError thrown contained a message
stating that the value did not exist (i.e., "No Value at JSON Path"),
which was not only misleading but also technically incorrect.

This commit fixes the error message for such use cases. For example, the
AssertionError thrown in such use cases now resembles the following.

  At JSON path "$.name", value <Lisa> of type <java.lang.String> cannot
  be converted to type <byte[]>

Closes gh-25480
2020-08-01 16:35:54 +02:00
Sam Brannen 5a12e7b2c5 Fix typo in test method names 2020-08-01 16:30:12 +02:00
Sam Brannen 5576321b04 Reset charset field in MockHttpServletResponse
Prior to this commit, calling reset() on MockHttpServletResponse did not
reset the `charset` field to `false` which could result in the
"Content-Type" header containing `;charset=null` which in turn would
result in errors when parsing the "Content-Type" header.

This commit resets the charset field to `false` in
MockHttpServletResponse's reset() method to avoid such errors.

Closes gh-25501
2020-08-01 14:01:39 +02:00
Sam Brannen 785ab5798a Sync MockHttpServletResponse changes 2020-08-01 12:43:26 +02:00
Sam Brannen 89bb9cb749 Polish Javadoc 2020-08-01 12:26:56 +02:00
Sam Brannen 9b0729007f Polish MockHttpServletResponseTests 2020-08-01 12:26:38 +02:00
Sam Brannen 7dbf42e858 Polish contribution
See gh-25483
2020-07-29 20:16:21 +02:00
yilianhuaixiao 83a95832e6 Filter repeatable annotations in AnnotationTypeMappings
Prior to this commit, AnnotationTypeMappings did not filter repeatable
annotations with the supplied annotation filter.

Closes gh-25483
2020-07-29 17:11:24 +02:00
Sam Brannen b841e8560c Polish MergedAnnotation API internals 2020-07-29 17:08:58 +02:00
Sam Brannen 2b3fdfabb2 Remove unused class filtering support in AnnotationScanner
PR gh-25429 brought it to our attention that there was a bug in
AnnotationScanner when using a non-null class filter that filtered out
classes; however, it turns out that there is no production code that
utilizes the package-private class filtering support.

This commit therefore removes all class filtering support from
AnnotationScanner since that functionality is effectively unused.

Closes gh-25477
2020-07-28 09:58:14 +02:00
Sam Brannen 5442d8779a Polish contribution
See gh-25429
2020-07-25 15:24:36 +02:00
yilianhuaixiao 650cbeee14 Avoid infinite loop in AnnotationScanner
Prior to this commit, scanning for annotations resulted in an infinite
loop when using the INHERITED_ANNOTATIONS search strategy and a class
filter that filters out visited classes.

This commit avoids an infinite loop in AnnotationsScanner's
processClassInheritedAnnotations(...) method by skipping the current
level of the class hierarchy when the current source class has been
filtered out.

Closes gh-25429
2020-07-25 15:23:21 +02:00
Sam Brannen 335c3d5db6 Polish contribution
See gh-25445
2020-07-22 17:26:59 +02:00
XenoAmess ab859fcc96 Refine use of substring operations
Closes gh-25445
2020-07-22 17:26:42 +02:00
Spring Buildmaster fc6b38a8f6 Next Development Version 2020-07-21 08:20:59 +00:00
Jay Bryant 1c83b3fc22 Wording changes
Replace potentially insensitive language with more neutral language.

Closes gh-25314
2020-07-20 17:14:13 +02:00