Commit Graph

20765 Commits

Author SHA1 Message Date
Rossen Stoyanchev d2bcf1ed71 Upgrade to RSocket 1.0.0-RC7
Closes gh-24934
2020-04-28 06:28:04 +01:00
Rossen Stoyanchev afc8a5d786 Upgrade to Reactor Dysprosium-SR7
Closes gh-24892
2020-04-27 13:24:53 +01:00
Rossen Stoyanchev f425a993e7 Ignore missing STOMP decoder if session closed
Closes gh-24842
2020-04-27 13:19:43 +01:00
Juergen Hoeller 57f1e86a35 AnnotationBeanNameGenerator caches meta-annotations for stereotype check
Closes gh-24980
2020-04-27 13:47:58 +02:00
Juergen Hoeller 73fadd8b7c Polishing 2020-04-27 11:45:41 +02:00
Juergen Hoeller 127e879726 Store source in index-derived ScannedGenericBeanDefinition as well
Includes consistent constructor-level storage of derived resource in ScannedGenericBeanDefinition and ConfigurationClassBeanDefinition.

Closes gh-24978
2020-04-27 11:45:08 +02:00
Sam Brannen 59ecd4997c Optimize toString() for synthesized annotations
This commit moves the toString() implementation for synthesized
annotations from TypeMappedAnnotation to
SynthesizedMergedAnnotationInvocationHandler in order to take advantage
of the synthesized annotation attribute value cache introduced in
72b1abd226.

Closes gh-24970
2020-04-26 14:14:07 +02:00
Sam Brannen db45b80b1f Suppress warnings for deprecated AnnotationFilter.NONE enum constant
See gh-24932
2020-04-26 13:58:31 +02:00
Juergen Hoeller f6df21eaa9 Upgrade to Mockito 3.3.3, MockK 1.10, HtmlUnit 2.39, Checkstyle 8.31 2020-04-25 18:00:34 +02:00
Juergen Hoeller ad088f2157 Polishing 2020-04-25 17:59:04 +02:00
Juergen Hoeller 5bca18f091 Upgrade to Netty 4.1.49, Groovy 2.5.11, Log4J 2.13.2, Hibernate Validator 6.1.4 2020-04-25 16:37:58 +02:00
Juergen Hoeller af65b1ca62 Polishing 2020-04-25 16:37:16 +02:00
Juergen Hoeller e5a292fb34 Deprecate AnnotationFilter.NONE and document MergedAnnotations design
Closes gh-24932
2020-04-25 16:36:44 +02:00
Juergen Hoeller e36a415994 Explain FactoryBean lifecycle management and destroy method handling
Closes gh-24948
2020-04-25 16:34:59 +02:00
Juergen Hoeller 401f9599ca Caching of autowire candidate metadata for injection point matching
Closes gh-24904
2020-04-25 16:34:28 +02:00
Juergen Hoeller 0552102780 Enforce limit for storing suppressed exceptions
Closes gh-24902
2020-04-25 16:33:35 +02:00
liuhy365 3af54692fa Fix parent bean factory self-reference issue.
If set parent bean factory to self, once try to get an undefined bean,  bellow condition
if (parentBeanFactory != null && !containsBeanDefinition(beanName)) {
...
}
will always be true and  StackOverflowError will be thrown.
Sometimes, this issue is hard to detect during runtime, if self-reference is not allowed here, error will be found at the early time of startup.
Also, a self-reference parent bean factory is valueless.
2020-04-25 16:28:09 +02:00
mattbertolini 21887ad23b Allow override of data binder binding
Motivation
----------
The Spring MVC ModelAttributeMethodProcessor includes many helpful
extension methods that allow developers to extend and enhance the data
binding capabilities of the class. Unfortunately, Spring WebFlux's
equivalent class, the ModelAttributeMethodArgumentResolver, does not
include these same extension methods. I am leveraging these extension
methods, specifically the bindRequestParameters method, to provide
valuable enhancements to my application. I would like to provide these
same enhancements to the WebFlux portion of my application and am
unable to do so at this time. I would like to update the WebFlux
ModelAttributeMethodArgumentResolver to add the bindRequestParameters
method.

Modifications
-------------
I created a new method called bindRequestParameters and encapsulated
the WebExchangeDataBinder bind call inside of it. This method is
marked as protected as it should only be used by children of this
class. This change mirrors the behavior in the equivalent Spring MVC
class (ModelAttributeMethodProcessor).

Result
------
The WebFlux ModelAttributeMethodArgumentResolver can now accept
alternative data binding implementations mirroring the Web MVC
behavior.
2020-04-25 16:27:36 +02:00
Сергей Цыпанов bff1a1932f Rid pointless wrapping with BufferedInputStream from class reading 2020-04-25 16:27:01 +02:00
Sam Brannen 72b1abd226 Reintroduce synthesized annotation attribute value caching
Prior to the introduction of the MergedAnnotation API in Spring Framework
5.2, our SynthesizedAnnotationInvocationHandler utilized a cache for
annotation attribute values; whereas, the new
SynthesizedMergedAnnotationInvocationHandler has no such caching in
place.

Issues such as gh-24961 indicate a regression in performance caused by
the lack of such an attribute value cache. For example, the required
attribute in @RequestParam is looked up using the internal meta-model
in the MergedAnnotation API twice per request for each @RequestParam in
a given controller handler method.

This commit reintroduces the attribute value cache to avoid the
unnecessary performance overhead associated with multiple lookups of
the same attribute in a synthesized annotation. This applies not only
to direct attribute method invocations but also to invocations of
equals() and hashCode() on a synthesized annotation.

Note, however, that this commit does NOT address multiple lookups of
annotation attribute values for invocations of toString(). That behavior
currently remains unchanged in the implementation of
org.springframework.core.annotation.TypeMappedAnnotation.toString().

Closes gh-24970
2020-04-25 15:28:09 +02:00
rahulmlokurte 0e9da17910
Fix typo in webmvc-functional.adoc
Closes gh-24968
2020-04-25 09:24:15 +02:00
Rossen Stoyanchev 583435d068 Consistent ordering in MethodNotAllowedException
This caused random failures in a newly added test. Also remove defensive
check in ResponseStatusExceptionResolver.

See gh-24944
2020-04-25 07:33:30 +01:00
Rossen Stoyanchev 2002a1689a Adapt test to changes in RSocket Java
See gh-24934
2020-04-25 07:11:34 +01:00
Rossen Stoyanchev 18474c921d Document IAE in HttpHeaders methods that parse ETags
See gh-24950
2020-04-24 13:02:12 +01:00
Rossen Stoyanchev d9262b8a0c Suppress deprecated Reactor Netty call
See gh-24892
2020-04-24 12:57:16 +01:00
Rossen Stoyanchev e18901d6b1 Headers support in ResponseStatusExceptionResolver
Closes gh-24944
2020-04-24 12:53:00 +01:00
Sam Brannen 8265db0ae1 Avoid synthesizing annotations unnecessarily
Commit 31fa1569c5 introduced initial support for avoiding unnecessary
annotation synthesis in the MergedAnnotation API; however, it only
avoided synthesis for annotations that do not declare any attributes.

This commit reworks this support to avoid unnecessary annotation
synthesis for annotations that declare attributes.

Specifically, this commit introduces a new `isSynthesizable()` method
in AnnotationTypeMapping that allows the "synthesizable" flag to be
computed once and cached along with the other metadata already cached
in AnnotationTypeMapping instances. TypeMappedAnnotation now delegates
to this new method when determining whether it should synthesize an
annotation.

Closes gh-24861
2020-04-23 19:09:30 +02:00
Rossen Stoyanchev 0520ee0fb6 Use the Reactor Netty WebsocketServerSpec
Closes gh-24959
2020-04-23 13:50:00 +01:00
Brian Clozel dc4cda1b13 WARN against invalid patterns with PathPatternParser
As of gh-24952, `PathPatternParser` will strictly reject patterns with
`"**"` in the middle of them. `"**"` is only allowed at the end of the
pattern for matching multiple path segments until the end of the path.

Currently, if `"**"` is used in the middle of a pattern it will be
considered as a single `"*"` instead. Rejecting such cases should
clarify the situation.

This commit prepares for that upcoming change and:

* logs a warning message if such a case is used by an application
* expands the MVC and WebFlux documentation about URI matching in
general

Closes gh-24958
2020-04-23 13:03:05 +02:00
Sam Brannen 5eba1ae73c Avoid deprecation warning in DefaultRSocketRequesterBuilderTests 2020-04-22 19:19:34 +02:00
Sam Brannen a9cc7b3edc Improve tests for synthesized array of annotations 2020-04-22 15:17:33 +02:00
Sam Brannen 5721c747b2 Polishing 2020-04-21 18:47:28 +02:00
Sam Brannen 31fa1569c5 Avoid synthesizing annotations unnecessarily
Prior to Spring Framework 5.2, some of our annotation utilities would
not synthesize an annotation if it was already synthesized or not
synthesizable (i.e., did not declare local aliases via @AliasFor and
did not declare attributes that could override attributes in the
meta-annotation hierarchy above the given annotation); however, we lost
most of this functionality with the introduction of the new
MergedAnnotations API.

This commit revises the implementation of createSynthesized() in
TypeMappedAnnotation so that, for invocations of
MergedAnnotation.synthesize() and indirectly for invocations of
AnnotatedElementUtils.findMergedAnnotation(), etc.:

1. An annotation that was previously synthesized will not be
   synthesized again.

2. An annotation that is not "synthesizable" will not be synthesized.

For both of the above use cases, the original annotation is now
returned from createSynthesized().

Closes gh-24861
2020-04-21 13:31:06 +02:00
Rossen Stoyanchev 8d31dcaa29 Clarification on path extension deprecations
Closes gh-24642
2020-04-20 14:43:07 +01:00
Rossen Stoyanchev 4b85b44bbd Update Javadoc of InputStreamResource#contentLength
Closes gh-20990
2020-04-20 12:53:42 +01:00
Rossen Stoyanchev fa5e8485ab
Update StackOverflow link 2020-04-20 12:32:11 +01:00
Rossen Stoyanchev 1904e9b7e7 Disable failing test temporarily 2020-04-20 10:16:40 +01:00
Sébastien Deleuze 6d5080825c Remove potentially confusing kotlin-reflect related log message
Closes gh-24935
2020-04-20 11:00:29 +02:00
Rossen Stoyanchev ed8c61a852 Upgrade to RSocket 1.0 RC7 snapshots 2020-04-20 09:42:28 +01:00
Sam Brannen 376434eb75 Polishing 2020-04-19 19:17:02 +02:00
Sam Brannen f42955c31b Polishing 2020-04-19 17:49:08 +02:00
Mikael d6c9c7d642
Simplify substring() usage in MimeTypeUtils
Closes gh-24933
2020-04-19 17:39:06 +02:00
Sam Brannen 3dadcaeb2d Polishing 2020-04-17 19:07:49 +02:00
Johnny Lim 87fa2c3b97
Avoid unnecessary String instantiation in StringUtils.deleteAny()
This commit avoids unnecessary String instantiation in
StringUtils.deleteAny() if nothing was deleted from the
input string.

Closes gh-24924
2020-04-17 18:44:16 +02:00
Deycoesr 87f28ce48e
Simplify some control flow code
Closes gh-24925
2020-04-17 18:32:02 +02:00
Sam Brannen b8835c9f32 Copy MockHttpServletRequest changes to spring-web
See gh-24916
2020-04-17 16:20:42 +02:00
Sam Brannen 6b410df45b Retain brackets for IPV6 address in MockHttpServletRequest
According to the Javadoc for ServletRequest's getServerName() method,
when the `Host` header is set, the server name is "the value of the
part before ':' in the Host header value ...". For a value representing
an IPV6 address such as `[::ffff:abcd:abcd]`, the enclosing square
brackets should therefore not be stripped from the enclosed IPV6
address.

However, the changes made in conjunction with gh-16704 introduced a
regression in Spring Framework 4.1 for the getServerName() method in
MockHttpServletRequest by stripping the enclosing brackets from the
IPV6 address in the `Host` header. Similarly, the changes made in
conjunction with gh-20686 introduced a regression in Spring Framework
4.3.13 and 5.0.2 in the getRequestURL() method in
MockHttpServletRequest by delegating to the getServerName() method
which strips the enclosing brackets.

This commit fixes the implementation of getServerName() so that the
enclosing brackets are no longer stripped from an IPV6 address in the
`Host` header. The implementation of getRequestURL() is therefore also
fixed.

In addition, in order to avoid a NullPointerException, the
implementations of getServerName() and getServerPort() now assert that
an IPV6 address present in the `Host` header correctly contains an
opening and closing bracket and throw an IllegalStateException if that
is not the case.

Closes gh-24916
2020-04-17 15:01:35 +02:00
Sam Brannen 0017256968 Test that @TestConstructor can be used as a meta-annotation 2020-04-17 13:29:33 +02:00
Oliver Degener df291a39b1
Fix Javadoc link in DefaultCorsProcessor
Closes gh-24921
2020-04-17 09:26:53 +02:00
Brian Hartung 1658223e58 Fixed typo
Fixed another small documentation typo.
2020-04-15 14:20:35 +01:00