1791 Commits

Author SHA1 Message Date
Stephane Nicoll
55f7b3a535 Rename nettyServerCustomizers to serverCustomizers
Closes gh-11155
2017-11-29 11:11:00 +01:00
Johnny Lim
952224ef56 Polish
Closes gh-11193
2017-11-29 10:50:42 +01:00
Stephane Nicoll
33bd7ccc91 Merge branch '1.5.x' 2017-11-29 10:47:52 +01:00
Johnny Lim
decf2dc1b7 Fix assertion locations
Closes gh-11171
2017-11-28 09:44:45 +01:00
Johnny Lim
01a48412d2 Polish
Closes gh-11126
2017-11-23 16:00:55 +00:00
Andy Wilkinson
1a76b5122d Merge branch '1.5.x' 2017-11-23 14:21:17 +00:00
Andy Wilkinson
c748a009b0 Merge branch '1.5.x' 2017-11-23 12:43:29 +00:00
Stephane Nicoll
59df2909b8 Format 2017-11-23 10:16:32 +01:00
Phillip Webb
05d2ca4f16 Allow bean binding if property binding fails
Update `Binder` so that if a property exists, but it cannot be converted
to required type, bean binding is attempted.

Prior to this commit, if a user happened to have an environment
variable named `SERVER` the binder would fail when trying to directly
convert its `String` value into a `ServerProperties`

Fixes gh-10945
2017-11-22 23:18:21 -08:00
Phillip Webb
47bc5e71ab Polish 2017-11-22 13:17:26 -08:00
Andy Wilkinson
64ae83b964 Polish visibility in ConfigurationPropertiesBinderBuilder 2017-11-21 12:20:49 +00:00
Phillip Webb
e82913dd5a Align appendix edits with source code
Port editing changes from append to java source files to ensure that
IDE meta-data also reflects the improvements.

Closes gh-10870
2017-11-20 15:47:49 -08:00
Phillip Webb
64c5e8b6ed Rename @DurationUnit -> @DefaultDurationUnit
Rename `@DurationUnit` to `@DefaultDurationUnit` to make it clearer
that it only changes the unit if one isn't specified by the user.

Closes gh-11078
2017-11-20 12:18:14 -08:00
Phillip Webb
8f4bf233b4 Update configuration properties to use Duration
Update appropriate configuration properties to use the `Duration`
type, rather than an ad-hoc mix of milliseconds or seconds.

Configuration properties can now be defined in a consistent and readable
way. For example `server.session.timeout=5m`.

Properties that were previously declared using seconds are annotated
with `@DurationUnit` to ensure a smooth upgrade experience. For example
`server.session.timeout=20` continues to mean 20 seconds.

Fixes gh-11080
2017-11-19 21:52:57 -08:00
Phillip Webb
7c6c9ddf09 Refine duration converter for optional suffix
Update `StringToDurationConverter` so that the suffix is optional and
values such as `100`, `+100`, `-100` are assumed to be milliseconds.

Also add support for `@DurationUnit` to allow the unit to be changed
on a per-field basis (allowing for better back-compatibility).

Closes gh-11078
2017-11-19 21:49:35 -08:00
Phillip Webb
74c48767a1 Add beanFactory context constructors
Align `WebServer` application contexts with Spring Framework by allowing
a custom beanFactory to be used on construction.

Fixes gh-8547
2017-11-18 21:55:03 -08:00
Phillip Webb
99afc4bc1f Allow more flexible Duration binding
Extend `BinderConversionService` to support `Duration` parsing of
the more readable `10s` form (equivalent to 10 seconds). Standard
ISO-8601 parsing also remains as an option.

Fixes gh-11078
2017-11-18 21:41:27 -08:00
Johnny Lim
73c65286ea Polish 2017-11-18 10:07:30 -08:00
Phillip Webb
7ff2cb5dc8 Polish 2017-11-18 10:03:30 -08:00
Stephane Nicoll
3e9c2b84b6 Fix default ReactiveWebApplicationContext class
Closes gh-11074
2017-11-18 09:53:45 +01:00
dreis2211
23da409b31 Remove duplicate words
Closes gh-11073
2017-11-18 09:17:30 +01:00
Johnny Lim
1783a072ad Remove explicit constructor super() calls
Closes gh-11068
2017-11-17 16:44:16 -08:00
Phillip Webb
a6cefc5ba0 Polish 2017-11-17 14:18:31 -08:00
Stephane Nicoll
4ff8126217 Make binder API private again
Closes gh-10867
2017-11-17 11:23:34 +01:00
Johnny Lim
e8563c54dd Polish
Closes gh-11050
2017-11-17 09:56:16 +01:00
Johnny Lim
cbb483735d Polish
Closes gh-10948
2017-11-16 10:36:20 +01:00
Phillip Webb
3035df59cc Use a String[] so sential nodes are trimmed
Update `RedisProperties` to use an actual String[] for sentinal nodes
rather than a simple String. This allows us to lean on the updated
binder to automatically trim the elements.

Fixes gh-11029
2017-11-15 16:19:59 -08:00
Phillip Webb
f647f5689f Polish 2017-11-15 12:47:47 -08:00
Andy Wilkinson
e92e56dda5 Drop LevelRemappingAppender
Drop LevelRemappingAppender as, following the changes made in e8f8556d
for gh-7657, it was no longer having any effect.

Closes gh-10842
2017-11-12 12:00:59 +00:00
Andy Wilkinson
07462be090 Polish 2017-11-11 16:29:12 +00:00
Johnny Lim
bd0dcfb172 Utilize StandardCharsets
Closes gh-10972
2017-11-10 09:49:13 +01:00
Madhura Bhave
8db77a6a61 Properly configure tldSkipPatterns for Tomcat
Fixes gh-10391
2017-11-07 14:54:32 -08:00
Phillip Webb
06b1b453a6 Limit when SystemEnvironment mapping is used
Update `SpringConfigurationPropertySource` so that the
`SystemEnvironmentPropertyMapper` is only used for the "actual" system
environment property source. This allows SystemEnvironmentProperySource
class to be used for other purposes (for example, Spring Cloud uses it
to as an override source providing decryption).

Only property sources named `systemEnvironment` or ending with
`-systemEnvironment` now have the `SystemEnvironmentPropertyMapper`
applied. The `TestPropertyValues` has been retrofitted to name the
source it adds appropriately.

Fixes gh-10840
2017-11-06 13:12:25 -08:00
Phillip Webb
e9f31f9c34 Improve configuration properties back-compatibility
Refine `SystemEnvironmentPropertyMapper` to support environment
variables that would have worked in Spring Boot 1.5. Specifically,
camelCase property bindings now support an additional underscore. The
recommended way to map `fooBar` is still `PREFIX_FOOBAR`, however,
`PREFIX_FOO_BAR` will now also work.

Fixes gh-10873
2017-11-06 11:21:16 -08:00
Phillip Webb
1e7d85a632 Polish 2017-11-06 10:11:50 -08:00
Stephane Nicoll
dbea25fa8b Polish "Log context path at startup"
Closes gh-10544
2017-11-06 12:49:43 +01:00
tinexw
f76479fb99 Log context path at startup
See gh-10544
2017-11-06 12:49:43 +01:00
Andy Wilkinson
60afbdc868 Polish 2017-11-06 11:44:53 +00:00
Phillip Webb
0fbb4989da Allow recursive list binding when iterable source
Further refine recursive binding rules so that Lists are supported when
the underlying source is iterable.

Close gh-10702
2017-11-05 09:39:17 -08:00
Phillip Webb
588dcf76c6 Only allow binder recursion with Maps
Refine the binder recursion rules introduced in commit f337323819 so
they only apply to Maps. Recursive List and Array binding is now no
longer allowed. Prior to this commit, binding a List that contained a
reference to itself would fail with a `StackOverflowException` if the
underlying property source was not iterable.

Fixes gh-10702
2017-11-04 23:14:03 -07:00
Madhura Bhave
99ad79dbe6 Add tests to trigger binder stack overflow error
Update `CollectionBinderTests` with additional tests that cause a
`StackOverflowException` due to recursive list binding.

See gh-10702
2017-11-04 23:06:38 -07:00
Phillip Webb
861469fb72 Remove accidental System.out 2017-11-04 21:57:59 -07:00
Phillip Webb
fabf14ff35 Allow ApplicationPid to write to a new file
Update `ApplicationPid` so that "canWrite" is only called for files
that already exist.

See gh-9922
Fixes gh-10784
2017-11-03 23:54:31 -07:00
Phillip Webb
fa191d8c73 Align ReactiveWebApplicationContext with framework
Refactor `ReactiveWebApplicationContext` implementations to align closer
with the `WebApplicationContext` implementations defined in
Spring Framework.

The following classes are now provided:

  - `AnnotationConfigReactiveWebApplicationContext` -- A refreshable
    reactive web context with support for `@Configuration` classes.

  - `GenericReactiveWebApplicationContext` -- A non-refreshable reactive
    GenericApplicationContext.

  - `ReactiveWebServerApplicationContext` --  A non-refreshable reactive
    GenericApplicationContext with support for server discovery.

  - `AnnotationConfigReactiveWebServerApplicationContext` -- A
    non-refreshable reactive `GenericApplicationContext` with support
    for `@Configuration` classes and server discovery.

These classes roughly align to the following Servlet equivalents:

  - `AnnotationConfigWebApplicationContext` (Spring Framework)
  - `GenericWebApplicationContext` (Spring Framework)
  - `ServletWebServerApplicationContext` (Spring Boot)
  - `AnnotationConfigServletWebServerApplicationContext` (Spring Boot)

An additional `ConfigurableReactiveWebEnvironment` interface as also
been introduced, primarily for `@ConditionalOnWebApplication` to use.

Fixes gh-10852
2017-11-03 19:07:23 -07:00
Phillip Webb
427d262297 Polish 2017-11-03 19:07:23 -07:00
Andy Wilkinson
bfe2f85a4f Merge branch '1.5.x' 2017-11-03 14:46:25 +00:00
Brian Clozel
bb9396e3a4 Enable HTTP/2 support for Tomcat and Undertow
This commit enables HTTP/2 support for Tomcat and Undertow, for both
Servlet-based and Reactive applications.

Enabling the `server.http2.enabled` configuration flag is enough with
Undertow.

Tomcat has a few prerequisites:

* Tomcat 8.5 requires JDK8+ and the proper libtcnative version installed
on the host
* Tomcat 9.0.x requires JDK9+

Closes gh-10043
2017-11-03 14:10:40 +01:00
Brian Clozel
58db841c8f Add Http2 configuration properties
This commit adds a new configuration properties class for configuring
HTTP/2 protocol support.
By default, this protocol is disabled as enabling it requires several
manual changes:

* configuring a web server for proper TLS and ALPN support
* configuring a proper SSL certificate

See gh-10043
2017-11-03 13:56:06 +01:00
Brian Clozel
7f58db7d0e Apply TLS configuration to reactive web servers
This commit applies the SSL configuration to the following reactive web
servers: Jetty, Tomcat, Undertow, Reactor Netty.

Closes gh-9431
2017-11-03 13:56:06 +01:00
Brian Clozel
5f57578b71 Enable APR optional support in Tomcat servers
This commits adds the AprLifecycleListener as a default
LifecycleListener in order to detect and use automatically the
tomcatnative library if it is available, for SSL support.

This feature can be useful for both performance reasons or for
supporting ALPN when using JDK8.

See gh-10043
Closes gh-9964
2017-11-03 13:56:06 +01:00