639 Commits

Author SHA1 Message Date
Phillip Webb
c66781a3d3 Set using collection copies when possible
Update `Map` and `Collection` binders to create a copy of the existing
collection whenever possible. Prior to this commit the binder would
always mutate the existing value and then call the setter with the
same instance. This could cause issues if the setter expected a
different instance.

Fixes gh-12322
2018-03-18 12:46:13 -07:00
Andy Wilkinson
72e36eadae Polish 2018-03-17 15:28:05 +00:00
Phillip Webb
620208a802 Polish 2018-03-16 13:39:50 -07:00
Phillip Webb
522e3df394 Fix same name configuration properties adapting
Update `SpringConfigurationPropertySources` adapter logic so that and
exact instance match is used when checking if the cache can be used.

Prior to this commit if a property source was replaced with one that
had exactly the same name, the adapted version would not change.

Fixes gh-12451
2018-03-15 16:14:17 -07:00
Phillip Webb
c201c1dac1 Polish 2018-03-15 16:09:14 -07:00
Madhura Bhave
9384e5c3c1 Fix binding to bean with cloned arrays
Fixes gh-12478
2018-03-15 14:14:20 -07:00
Phillip Webb
d1e51d7f98 Explicitly set asyncSupported for reactive servers
Update `JettyReactiveWebServerFactory`/`TomcatReactiveWebServerFactory`
to explicitly set `asyncSupported` to `true`.

Fixes gh-12486
2018-03-14 16:09:45 -07:00
dreis2211
8626daf135 Replace Mockito.times(0) with Mockito.never()
Closes gh-12475
2018-03-14 15:12:20 -07:00
Phillip Webb
90949669be Polish "refactor spring-boot JSON parser"
Polish JSON parser refactoring and remove some more duplication.

Closes gh-12428
2018-03-14 14:54:21 -07:00
Anton Telechev
aa69621078 Refactor spring-boot JSON parsers
Refactor JSON parser wrappers to remove duplicate code portions in the
parseMap() and parseList() methods by adding an AbstractJsonParser.

See gh-12428
2018-03-14 14:53:35 -07:00
Phillip Webb
a4b0be089d Polish 2018-03-14 14:05:26 -07:00
Madhura Bhave
6d9692ffb7 Fix binding to empty prefix when empty name present
Fixes gh-12381
2018-03-12 12:35:08 -07:00
Stephane Nicoll
ed05e1f7ca Polish "Reorder modifiers to comply with the JLS"
Closes gh-12432
2018-03-12 15:17:23 +01:00
igor-suhorukov
aebb475bc5 Reorder modifiers to comply with the JLS
See gh-12432
2018-03-12 15:17:05 +01:00
igor-suhorukov
6ee04ff942 Polish
Closes gh-12425
2018-03-10 10:28:04 +01:00
Madhura Bhave
6bcdd57ef2 Polish 2018-03-09 10:39:44 -08:00
Madhura Bhave
26811b8974 Ignore top-level ConfigurationProperty binding failures
Fixes gh-12357
2018-03-09 10:36:36 -08:00
Andy Wilkinson
9b637d4f0d Use millisecond precision for build time in BuildPropertiesTests
Closes gh-12420
2018-03-09 11:59:26 +00:00
Andy Wilkinson
87239ba6c9 Parse build.time as an ISO 8601 instant
Closes gh-12420
2018-03-09 11:32:43 +00:00
Stephane Nicoll
7d1faa1c88 Ignore static and abstract accessors
This commit updates the annotation processor and the binder to ignore
any static or abstract method that has the characteristics of a JavaBean
accessor. As a result, no property is generated for those (invalid)
accessor and no binding occurs on them either.

Closes gh-12390
2018-03-07 17:55:12 +01:00
Stephane Nicoll
9b1003d9f6 Properly identify accessor methods
This commit fixes the binder so that it property identifies JavaBean
accessors. Previously an accessor named `get` or `is` was identified.
Similarly, a setter named `set` was identified.

Closes gh-12363
2018-03-07 15:14:07 +01:00
Andy Wilkinson
317b51f2ad Make ApplicationContextRequestMatcher and subclasses thread-safe
Previously, when performing lazy initialisation of the context,
ApplicationContextRequestMatcher assigned the context field before it
called initialized. The context being non-null is used as the signal
that it’s ok to call a subclass’s matches method. If one thread checks
for a non-null context in between the field being assigned and
initialized being called on another thread, matches will be called
before the subclass is ready.

This commit closes the window for the race condition by only assigning
the context field once the subclass’s initialized method has been
called.

There is a secondary problem in each of the subclasses. Due to the use
of double-checked locking in ApplicationContextRequestMatcher, it’s
possible for a subclass’s matches method to be called by a thread that
has not synchronised on the context lock that’s held when initialized
is called and the delegate field is assigned. This means that the
value assigned to the field may not be visible to that thread.

This commit declares the delegate field of each
ApplicationContextRequestMatcher subclass as volatile to ensure that,
following initialisation, its value is guaranteed to be visible to
all threads.

Closes gh-12380
2018-03-07 11:37:01 +00:00
Johnny Lim
751c444166 Polish
See gh-12326
2018-03-03 12:25:41 +01:00
Stephane Nicoll
ef9fb1696c Merge branch '1.5.x' 2018-03-01 17:26:51 +01:00
Andy Wilkinson
ef157d3649 Fix Checkstyle violations 2018-02-28 19:59:39 +00:00
Phillip Webb
7bc535e4fa Polish 2018-02-28 10:59:26 -08:00
Andy Wilkinson
35b7a16917 Merge branch '1.5.x' 2018-02-28 11:24:08 +00:00
Brian Clozel
14d36c9ad8 Polish
Closes gh-12268
2018-02-28 09:36:21 +01:00
Stephane Maldini
7866b946f7 Add Netty Compression support
Reactor Netty 0.7.5 now supports all Compression options.
Unlike previous Reactor Netty versions, the minimum compression
threshold is now based on the content-length instead of
accumulating for a while the data.

See gh-12268
2018-02-28 09:36:21 +01:00
Stephane Nicoll
4180762d6d Polish contribution
Closes gh-12236
2018-02-28 09:01:59 +01:00
igor-suhorukov
56cbc65e7b Polish
See gh-12236
2018-02-28 08:58:46 +01:00
Phillip Webb
d66496787d Propagate exceptions in security matchers
Update `ApplicationContextRequestMatcher` and
`ApplicationContextServerWebExchangeMatcher` to use a supplier for
the context, rather than the context itself.

This allow exceptions to be propagated to subclasses which may choose
to deal with them.

See gh-12238
2018-02-27 16:29:14 -08:00
Brian Clozel
438004efe5 Simplify HTTP compression support for Reactor Netty
This commit simplifies the HTTP compression configuration for Reactor
Netty servers.

Also, this commit removes a test for the
`server.compression.min-response-size` support, as this is only
supported when the HTTP response contains a `Content-Length` header.
Since most Spring WebFlux responses are using
`Transfer-Encoding: chunked`, we should not test for that case.

See gh-12268
2018-02-27 23:47:35 +01:00
Madhura Bhave
7f85322ddd Fix checkstyle 2018-02-27 13:38:54 -08:00
Andy Wilkinson
dc36360155 Polish 2018-02-27 21:25:48 +00:00
Phillip Webb
3e4da3cc37 Polish 2018-02-27 12:53:01 -08:00
Andy Wilkinson
0ba192dead Merge branch '1.5.x' 2018-02-27 14:47:13 +00:00
Andy Wilkinson
37a66349fe Fall back to application conversion service in BindConverter
Previously, if a user declared a custom conversionService bean that
was not an ApplicationConversionService instance, the binder lost
the ability to convert a String to a Duration (along with any other
conversions that are specific to ApplicationConversionService).

This commit updates BindConverter so that, if the ConversionService
with which it is created is not an ApplicationConversionService, it
will use one as an additional service when performing conversion.

Closes gh-12237
2018-02-27 13:12:48 +00:00
Stephane Nicoll
569bad16da Polish 2018-02-27 10:54:43 +01:00
Phillip Webb
c0d79b9273 Rationalize multi-document config file handling
Update `PropertySourceLoader` so that it no longer needs to deal with
matching multi-document files using the `spring.profile` property. The
loader now simply returns one or more `PropertSource` instances for a
given `Resource`.

All property matching now occurs in the `ConfigFileApplicationListener`.
This allows document processing logic to be contained in a single place,
and allows us to rationalize the algorithm so that negative matching
profiles are processed last.

Fixes gh-12159
2018-02-26 23:30:09 -08:00
Phillip Webb
145400505d Only validate target values on zero depth
Update `ValidationBindHandler` so that validation only occurs when a
value is bound, or the bind depth is zero. This prevents validation from
triggering getters which may throw an exception.

Fixes gh-12227
2018-02-26 23:08:45 -08:00
Phillip Webb
3244836003 Port Locale sensitive test from 1.5.x 2018-02-26 22:26:33 -08:00
Phillip Webb
29c3be3590 Polish 2018-02-26 10:26:02 -08:00
Stephane Nicoll
306c79f0de Merge branch '1.5.x' 2018-02-26 18:03:32 +01:00
dreis2211
cbabf5414c Polish argument capturing in two Tomcat tests
Closes gh-12203
2018-02-26 09:35:39 +01:00
igor-suhorukov
98f4692c62 Polish
This commit changes invocations to immediately return the expression
instead of assigning it to a temporary variable. The method name should
be sufficient for callers to know exactly what will be returned.

Closes gh-12211
2018-02-25 10:59:02 +01:00
dreis2211
e2fb093ccf Polish
See gh-12202
2018-02-24 16:09:38 +01:00
Johnny Lim
d441a8a89a Polish
Closes gh-12205
2018-02-24 11:53:25 +01:00
Stephane Nicoll
2b729bf114 Fix description of checkpoint-interval
See gh-12181
2018-02-23 13:03:08 +01:00
Stephane Nicoll
09ff815f00 Harmonize metadata
Closes gh-12177
2018-02-23 11:02:28 +01:00