Commit Graph

21624 Commits

Author SHA1 Message Date
Sam Brannen
9a93615ec4 Configure Kotlin plugin support for Eclipse in Gradle build
This commit configures the Kotlin plugin for Eclipse in the
spring-core-coroutines Gradle project so that users no longer have to
manually "Configure Kotlin / Add Kotlin Nature" within the Eclipse IDE
after importing projects.

This change is currently limited to the spring-core-coroutines project
since it is the only project in which Java code depends on compiled
Kotlin code; however, this change may later be applied to additional
projects if desirable.
2019-04-08 17:20:24 +02:00
Sam Brannen
bd414df944 Remove JMXMP from TestGroup
Due to the changes in a7425c81c0, we no
longer need to execute tests using the JMXMP protocol in PERFORMANCE
builds.

This commit removes the JMXMP constant from the TestGroup enum and
updates affected tests, thereby effectively including such tests in
the standard build from now on.

See gh-22757
2019-04-08 17:05:16 +02:00
Juergen Hoeller
fd8fa301a6 Consistent non-exposure of inherited annotations in AnnotationMetadata
Closes gh-22766
2019-04-08 15:59:06 +02:00
Sebastien Deleuze
2e7ed915cd Merge branch '5.1.x' 2019-04-08 15:46:47 +02:00
Sebastien Deleuze
a089027e7d Fix a regression in Jackson builder module registration
This commit brings back the support for registration of multiple
Jackson modules with a null typeId.

Closes gh-22740
2019-04-08 15:37:10 +02:00
Juergen Hoeller
43cb1af26a Polishing 2019-04-08 15:33:26 +02:00
Juergen Hoeller
a1efe3cfe5 Avoid MessageFormat processing for default Bean Validation messages
Closes gh-22761
2019-04-08 15:33:04 +02:00
Juergen Hoeller
fc9ce7cd99 Skip plain Java annotations in SourceClass.getAnnotations() upfront
Includes direct reflective introspection of annotations when possible.

Closes gh-22750
2019-04-08 15:32:52 +02:00
Sam Brannen
cf5d0e6aa9 Introduce publishEvent() convenience method in TestContext
This commit introduces a publishEvent() method in the TestContext API
as a convenience for publishing an ApplicationEvent to the test's
ApplicationContext but only if the ApplicationContext is currently
available and with lazy creation of the ApplicationEvent.

For example, the beforeTestClass() method in
EventPublishingTestExecutionListener is now implemented as follows.

  public void beforeTestClass(TestContext testContext) {
      testContext.publishEvent(BeforeTestClassEvent::new);
  }

Closes gh-22765
2019-04-08 15:14:39 +02:00
Sam Brannen
a7425c81c0 Add dependency on opendmk_jmxremote_optional_jar for performance builds
Although the jmxremote_optional JAR has been added to the build agents
on the Bamboo CI server for the latest JDK 8 installation, that
solution is brittle since it has to be manually installed in every new
JDK installation. In addition, this approach will not work with JDK 9+
since the "Extension Mechanism" has been removed beginning with JDK 9.

https://docs.oracle.com/javase/10/migrate/toc.htm#JSMIG-GUID-2C896CA8-927C-4381-A737-B1D81D964B7B

This commit addresses this issue by adding the following dependency to
spring-context.

// Substitute for "javax.management:jmxremote_optional:1.0.1_04" which
// is not available on Maven Central
testRuntime("org.glassfish.external:opendmk_jmxremote_optional_jar:1.0-b01-ea")

With this change, the Spring PERFORMANCE builds now execute on JDK 8,
9, and 11.

See gh-22757
2019-04-08 13:22:30 +02:00
Sam Brannen
8f5d2d65a1 Upgrade to JUnit Jupiter 5.4.2
See gh-22308
2019-04-07 22:05:33 +02:00
Sam Brannen
353e092bf6 Register EventPublishingTestExecutionListener by default (round 2)
This commit registers the EventPublishingTestExecutionListener as a
default TestExecutionListener with an order of 10,000. This registers
the EventPublishingTestExecutionListener as the last listener provided
by the Spring Framework.

With EventPublishingTestExecutionListener registered with an order of
10,000, it is effectively wrapped by all other Spring listeners,
including support for @DirtiesContext and test-managed transactions.

Furthermore, this commit revises the implementation of
EventPublishingTestExecutionListener to take advantage of the new
TestContext#hasApplicationContext() support which allows the
EventPublishingTestExecutionListener to publish events only if the
test's ApplicationContext is currently available. This avoids
undesirable side-effects such as eager loading of the
ApplicationContext before it is needed or re-loading of the
ApplicationContext after it has been intentionally closed.

Closes gh-18490
2019-04-06 16:39:26 +02:00
Sam Brannen
c3d0459a4e Add support to query if ApplicationContext is available in the TCF
This commit introduces support in the Spring TestContext Framework
(TCF) to query whether the test's ApplicationContext is available.

Specifically, this commit introduces the following two `default`
methods along with corresponding implementations in DefaultTestContext
and DefaultCacheAwareContextLoaderDelegate.

- `boolean hasApplicationContext()` in the TestContext API

- `boolean isContextLoaded(MergedContextConfiguration)` in the
  CacheAwareContextLoaderDelegate API

Closes gh-22756
2019-04-06 16:00:33 +02:00
Sam Brannen
ab1b8dee58 Ensure XmlEventDecoder compiles on JDK 9 and 11 2019-04-06 16:00:33 +02:00
Sam Brannen
55b764bac3 Remove unused import
See gh-22543
2019-04-06 12:14:46 +02:00
Sam Brannen
164ee2a4e1 Polishing
See gh-22543
2019-04-06 11:25:44 +02:00
Sam Brannen
021909dac2 Merge branch '5.1.x' 2019-04-06 11:22:15 +02:00
Sam Brannen
a1668ad1c2 Fix Javadoc for PathPattern 2019-04-06 11:21:39 +02:00
Sam Brannen
510c0c5ef7 Return Set<PathPattern> from AbstractHandlerMethodMapping.getMappingPathPatterns
This commit revises the signature of getMappingPathPatterns() in
AbstractHandlerMethodMapping to return a set of PathPatterns instead of
a set of Strings.

See gh-22543
2019-04-06 11:18:25 +02:00
Tadaya Tsuyukubo
dacda5859a Fix broken asciidoc heading 2019-04-06 11:02:45 +02:00
Rossen Stoyanchev
02da8486a3 Merge branch '5.1.x' 2019-04-05 21:53:55 -04:00
Rossen Stoyanchev
57558a481a DataBuffer fixes in View implementations
Closes gh-22754
2019-04-05 21:42:12 -04:00
Rossen Stoyanchev
6cabb79f0f Decode resourcePath for classpath locations
Closes gh-22272
2019-04-05 16:23:33 -04:00
Phillip Webb
e905f1712e Refine MergedAnnotation.asMap
Add a convenience method that allows a `MergedAnnotation` to be
converted into an `AnnotationAttributes` instance. Also rename
the `MapValues` enum to `Adapt` which generally seems to read
better.

Closes gh-22738
2019-04-05 13:22:18 -07:00
Phillip Webb
ef151f578d Polishing 2019-04-05 13:22:18 -07:00
Phillip Webb
1221b0650b Add MissingMergedAnnotation Tests
Add tests for `MissingMergedAnnotation`

See gh-21697
2019-04-05 13:21:46 -07:00
Phillip Webb
8bc74ad18d Delete AnnotationAttributeExtractor
Delete `AnnotationAttributeExtractor` which is package private and
no longer used.

Closes gh-22753
2019-04-05 13:20:47 -07:00
Sam Brannen
72027b1746 Log warning if @RequestMapping method has no explicit mapping
Commit c0b52d09f5 introduced support for
throwing an exception if a @RequestMapping handler method in a Spring
MVC controller was mapped to an empty path. This had negative side
effects for applications that intentionally mapped to an empty path,
potentially alongside a mapping to an explicit path for the same
handler method.

This commit addresses this by logging a warning (instead of throwing an
exception) if a @RequestMapping method is mapped only to empty paths.

This commit also introduces the same support for WebFlux-based
@RequestMapping handler methods.

Closes gh-22543
2019-04-05 19:55:22 +02:00
Sam Brannen
e4525cf4c1 Modify ByteArrayEncoder so that it works in Eclipse IDE 2019-04-05 19:55:22 +02:00
Sam Brannen
898494a538 Polish AbstractHandlerMethodMapping
See gh-22543
2019-04-05 14:03:10 +02:00
Sam Brannen
d04a640baf Polish Javadoc for @RequestMapping 2019-04-05 14:03:10 +02:00
Juergen Hoeller
9de83674cd Complete set of registerBean methods on AnnotatedBeanDefinitionReader
Includes bringing registerBean constructor-vararg variants up to GenericApplicationContext, making AnnotationConfigApplicationContext a straightforward subclass with a single template method to override.

See gh-22457
2019-04-05 13:56:33 +02:00
Juergen Hoeller
b90e6ef8a0 Merge branch '5.1.x' 2019-04-05 12:48:34 +02:00
Juergen Hoeller
da557e7415 Avoid expensive assertions in HttpRange
Closes gh-22742
2019-04-05 12:47:02 +02:00
Rossen Stoyanchev
279508a0f0 Merge pull request #22705 from jhaeyaert/22371 2019-04-04 17:15:18 -04:00
Rossen Stoyanchev
e0c2a1c59d Polish
Closes gh-22705
2019-04-04 17:13:57 -04:00
Jeoffrey Haeyaert
9976783639 WebClient uri method with uriTemplate and UriBuilder
See gh-22705
2019-04-04 17:13:57 -04:00
Rossen Stoyanchev
ed70978071 verify() fails if there are failed requests
Normally failed requests fail the test but they're suppressed for some
reason (e.g. in async callback) then verify should still correctly
report the failures.

Closes gh-21799
2019-04-04 16:49:46 -04:00
Sam Brannen
4be605eb1e Revert "Fix tests"
This reverts commit 07e9f802f2.
2019-04-04 19:10:58 +02:00
Sam Brannen
d6ba5259d8 Revert "Register EventPublishingTestExecutionListener by default"
This reverts commit 86fb7362b1.
2019-04-04 19:10:58 +02:00
Sam Brannen
a66e6d3231 Revert "Fix tests"
This reverts commit 65365d91c8.
2019-04-04 19:10:58 +02:00
Sam Brannen
f7a5b3013e Revert "Register EventPublishingTestExecutionListener by default"
This reverts commit 13543f5e0f.
2019-04-04 19:10:58 +02:00
Sebastien Deleuze
a8d6ba9965 Add support for Coroutines Flow
Flow is a Kotlin Coroutines related cold asynchronous
stream of the data, that emits from zero to N (where N
can be unbounded) values and completes normally or with
an exception.

It is conceptually the Coroutines equivalent of Flux with
an extension oriented API design, easy custom operator
capabilities and some suspending methods.

This commit leverages Flow <-> Flux interoperability
to support Flow on controller handler method parameters
or return values, and also adds Flow based extensions to
WebFlux.fn. It allows to reach a point when we can consider
Spring Framework officially supports Coroutines even if some
additional work remains to be done like adding
interoperability between Reactor and Coroutines contexts.

Flow is currently an experimental API that is expected to
become final before Spring Framework 5.2 GA.

Close gh-19975
2019-04-04 19:06:32 +02:00
Sam Brannen
a5e297a161 Polishing 2019-04-04 18:41:57 +02:00
Sam Brannen
df15b64e86 Document @Autowired support on parameters
Closes gh-21118
2019-04-04 18:31:04 +02:00
Sam Brannen
e1080f8b5f Polish Javadoc for @Autowired 2019-04-04 18:18:35 +02:00
Sam Brannen
3a9262ca1e Fix Javadoc warnings in Gradle build 2019-04-04 17:49:33 +02:00
Sam Brannen
c0b52d09f5 Require explicit path mappings for @RequestMapping methods
Prior to this commit, handler methods in Spring MVC controllers were
not required to provide explicit path mappings via @RequestMapping (or
any of its specializations such as @GetMapping). Such handler methods
were effectively mapped to all paths. Consequently, developers may have
unwittingly mapped all requests to a single handler method.

This commit addresses this by enforcing that @RequestMapping methods
are mapped to an explicit path. Note, however, that this is enforced
after type-level and method-level @RequestMapping information has been
merged.

Developers wishing to map to all paths should now add an explicit path
mapping to "/**" or "**".

Closes gh-22543
2019-04-04 17:33:59 +02:00
Sam Brannen
de69871354 Removed unused import 2019-04-04 17:13:08 +02:00
Sam Brannen
1a2e372186 Removed unused import 2019-04-04 16:56:03 +02:00