Commit Graph

1716 Commits

Author SHA1 Message Date
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
Phillip Webb f9da113943 Exclude FileEditor from binding conversion
Exclude `FileEditor` from the `BindConverter` since it uses slightly
unusual logic to create the file. Specifically, given a value of "."
the editor will locate a `ClassPathResource` then return `getFile()`
from that resource. For back-compatibility, binding should use the
simpler conversion service logic.

Fixes gh-12163
2018-02-22 22:01:37 -08:00
Phillip Webb 7e10d86ed3 Polish 2018-02-22 21:37:31 -08:00
Phillip Webb 3dea6fc645 Fix bind TypeConverter delegation with collections
Update `BindConverter` so that delegation to `SimpleTypeConverter` also
works with Collections and Arrays.

Prior to this commit, conversion that relied on a `PropertyEditor` would
only work for simple types. For example, "String -> Class<?>" would use
the `ClassEditor` but "String -> List<Class<?>>" would fail.

The `BindConverter` now uses a minimal `ConversionService` as an adapter
to the `SimpleTypeConverter`. This allows us to use the same delimited
string conversion logic as the `ApplicationConverter`.

Fixes gh-12166
2018-02-22 21:26:36 -08:00
Phillip Webb 4b9c3c137e Polish Collection.toArray
Consistently use `StringUtils.toStringArray`, `ClassUtils.toClassArray`
or zero length when converting collections to arrays.

Fixes gh-12160
2018-02-22 21:11:30 -08:00
Phillip Webb cd5266ac03 Polish 2018-02-22 20:25:28 -08:00
Johnny Lim 2fe86da95b Use isTrue() and isFalse() for AssertJ
Closes gh-12170
2018-02-22 09:55:40 +01:00
Johnny Lim 50c07d0772 Polish
Closes gh-12156
2018-02-21 17:46:57 +01:00
Madhura Bhave 33be78a91e Add additional profile negation tests
Closes gh-8011
2018-02-21 01:57:03 -08:00
Phillip Webb 4bde6b80ee Refactor YAML profile to deal with "!" profiles
Drop `SpringProfileDocumentMatcher` and replace it with two new
implementations that restrict when YAML documents are loaded. YAML
sections are now restricted both on the specific profile that is being
loaded, and the profiles that are currently accepted.

The `PropertySourceLoader` interface has been refined to include a
predicate that determines when a profile is accepted. The
`ConfigFileApplicationListener` simply delegates the predicate logic to
the `Environment`.

Fixes gh-8011
2018-02-21 01:57:03 -08:00
Phillip Webb 46021928ba Rework common server customization
Update the configurable embedded web server factory interfaces to
extend `ConfigurableWebServerFactory` so that the can be used in a
`WebServerFactoryCustomizer`.

Extract server specific customization to their own auto-configuration
and align reactive/servlet server auto-configuration.

Closes gh-8573
2018-02-20 16:27:15 -08:00
Phillip Webb 05faac2b09 Polish 2018-02-20 15:53:25 -08:00
Phillip Webb cdb5677375 Polish Binder constructor
Reinstate constructor signature used by Spring Cloud and improve
javadoc.

Closes gh-12095
2018-02-20 15:36:43 -08:00
Andy Wilkinson b5e2c5ec1c Polish 2018-02-20 19:58:39 +00:00
Stephane Nicoll ce01a9145b Polish 2018-02-20 18:45:36 +01:00
Stephane Nicoll 1b8f0d06a7 Test that custom `ProtocolResolver` is invoked
See gh-11659
2018-02-20 14:45:51 +01:00
Phillip Webb 20109e27be Add ApplicationConversionService and fix binder
Create a new `ApplicationConversionService` similar in design to the
DefaultFormattingConversionService from Spring Framework. The new
conversion service provides a central place for custom conversion logic
supported by Spring Boot.

Also replace the `BindingConversionService` with an internal
`BindConverter` class that now invokes the `SimpleTypeConverter`
directly. Binding for `@ConfigurationProperties` has been updated so
that any custom property editors registered with the BeanFactory can
be used.

Fixes gh-12095
2018-02-19 20:25:47 -08:00
Phillip Webb 61f44179cb Relocate XA wrapper types
Move `XADataSourceWrapper` to `jdb` and `XAConnectionFactoryWrapper` to
`jms` so that they are packaged in a similar way to the underlying XA
types.

Fixes gh-12061
2018-02-19 20:22:03 -08:00
igor-suhorukov fe023817c7 Polish static finals
Closes gh-12083
2018-02-19 20:10:58 -08:00
Johnny Lim 88b184ca23 Polish 2018-02-19 20:00:20 -08:00
Phillip Webb adf22d6e4a Polish 2018-02-19 19:54:10 -08:00
Phillip Webb 1d83e87bcd Validate @ConfigurationProperties on @Bean methods
Refactor `ConfigurationPropertiesBindingPostProcessor` to allow JSR-303
validation on `@ConfigurationProperties` defined at the `@Bean` method
level.

JSR-303 validation is now applied when a JSR-303 implementation is
available and `@Validated` is present on either the configuration
properties class itself or the `@Bean` method that creates it.

Standard Spring validation is also supported using a validator bean
named `configurationPropertiesValidator`, or by having the configuration
properties implement `Validator`.

The commit also consolidates tests into a single location.

Fixes gh-10803
2018-02-16 18:11:54 -08:00
Phillip Webb 9e75680e6f Polish 2018-02-16 18:11:54 -08:00
Andy Wilkinson a1ba2de06b Merge branch '1.5.x' 2018-02-14 17:22:52 +00:00
Phillip Webb 45347af62e Allow lifecycleTimeout to be set for Netty
Update `NettyReactiveWebServerFactory` and `NettyWebServer` to allow
the lifecycle (start/stop) timeout to be configured.

Fixes gh-10977
2018-02-13 15:16:29 -08:00
dreis2211 cd0c5ba4d5 Polish BannerTests
Closes gh-12029
2018-02-13 14:55:40 -08:00
igor-suhorukov e98b93844a Polish static final usage for constants
Closes gh-12032
2018-02-13 14:53:26 -08:00
Andy Wilkinson 214c7ebdd5 Start building against Spring Framework 5.0.4 snapshots again
This reverts commit 682612efa3.
2018-02-13 17:42:16 +00:00
Andy Wilkinson 682612efa3 Revert "Start building against Spring Framework 5.0.4 snapshots"
This reverts commit 9dd7b0689d.
2018-02-13 16:24:26 +00:00
Andy Wilkinson 9dd7b0689d Start building against Spring Framework 5.0.4 snapshots
This reverts commit f24c92c658 which is
no longer necessary as SPR-16456 has no been fixed.

See gh-11894
2018-02-13 13:43:47 +00:00
Andy Wilkinson db4ffbbc4b Expose constants for Spring application JSON property names
Closes gh-12012
2018-02-13 13:22:50 +00:00
Johnny Lim 87bf0b26df Polish modifier order
See gh-12019
2018-02-13 09:49:59 +01:00
Stephane Nicoll 31da4cc35d Polish "Remove redundant casts"
Closes gh-12011
2018-02-13 09:34:08 +01:00
igor-suhorukov 71351de694 Remove redundant casts
See gh-12011
2018-02-13 09:33:49 +01:00
Phillip Webb d6858ae162 Fix ConfigurationPropertySources parent attach
Update `ConfigurationPropertySources` so that the underlying sources
are checked when attaching. Prior to this commit, in a parent/child
setup the `ConfigurationPropertySources` adapter may already present
on the parent. This means the attaching is skipped but the managed
sources are incorrect.

Fixes gh-12013
2018-02-12 17:49:53 -08:00
Johnny Lim 5a9865dabb Polish
Closes gh-12004
2018-02-12 17:10:43 +01:00
Stephane Nicoll c97a9a0cb2 Merge branch '1.5.x' 2018-02-12 17:08:09 +01:00
Andy Wilkinson 2b9006b3fd Accumulate config classes across register calls
Closes gh-11998
2018-02-12 09:59:31 +00:00
Stephane Nicoll 5e0df39c66 Merge branch '1.5.x' 2018-02-10 15:06:16 +01:00
Stephane Nicoll a97a762086 Only set mapping resources when present
This commit sets a mapping resources list only when there is at least an
element in it. This allows the default fallback of finding an "orm.xml"
file to kick in when no customization has been applied.

Closes gh-11964
2018-02-09 12:01:08 +01:00
Phillip Webb 5de46c3186 Polish 2018-02-08 16:35:10 -08:00
Andy Wilkinson 5522174e96 Provide package info for all packages included in javadoc 2018-02-08 16:50:37 +00:00
Andy Wilkinson dec37ec5e2 Move EndpointMapping into spring-boot-actuator 2018-02-08 15:13:27 +00:00
Andy Wilkinson a09c64e18c Polish 2018-02-08 11:15:36 +00:00
Andy Wilkinson 76a450dfba Format with Eclipse Oxygen SR2 2018-02-08 10:53:53 +00:00
Madhura Bhave 761bcffc13 Consider generic information on @Bean method for bind
Fixes gh-11931
2018-02-07 13:55:09 -08:00
Madhura Bhave dd3bcc5691 Polish 2018-02-07 13:55:09 -08:00
Madhura Bhave 7d53c54364 Fallback to Object.class if ResolvableType can't resolve
Fixes gh-11908
2018-02-07 13:37:43 -08:00
dreis2211 7108a1fc49 Optimize ApplicationHome.isUnitTest()
Closes gh-11910
2018-02-07 12:57:03 +01:00
Phillip Webb 6889ad59b8 Support property based MeterFilters
Add per-meter property support for `enabled`, `percentiles-histogram`,
`percentiles` and `sla`.

Fixes gh-11800
2018-02-06 13:21:27 -08:00
Phillip Webb b5c4ce230d Ensure full commit id is always available
Update `GitProperties` so that the `commit.id` entry is also copied to
`commit.id.full`.

Prior to this commit, when returning full details, the value of
`commit.id` would be replaced with a `Map` containing only `abbriv` as
a key. By  copying the value to a sub-key we ensure that it remains
available both in the FULL and SIMPLE modes.

Fixes gh-11892
2018-02-02 19:00:35 -08:00
Phillip Webb 16b7dbf487 Only use Map converter binding when no descendants
Update `MapBinder` to only attempt conversion based binding when there
are no know descendant elements.

See gh-11892
2018-02-02 19:00:35 -08:00
Phillip Webb d6ae4e48d8 Add support for @Delimiter binding
Add a new `@Delimiter` annotation that can be used to change how a
String value is bound to a Collection.

Fixes gh-11883
2018-02-02 19:00:34 -08:00
Phillip Webb f24c92c658 Workaround ResolvableType.forClassWithGenerics bug
Temporarily work around SPR-16456
2018-02-02 18:59:06 -08:00
Phillip Webb 60d525e732 Polish IndexedElementsBinder 2018-02-02 18:59:06 -08:00
Phillip Webb 69234f8c08 Polish 2018-02-02 18:59:05 -08:00
Madhura Bhave 49a72b007b Bind to map with numeric key without needing []
Closes gh-10751
2018-02-02 09:48:04 -08:00
Andy Wilkinson cebe6579d1 Merge branch '1.5.x' 2018-02-02 15:01:35 +00:00
Andy Wilkinson 875091ed85 Polish “Remove or use unused method parameters”
Closes gh-11812
2018-02-02 09:34:19 +00:00
igor-suhorukov 717bd2c580 Remove or use unused method parameters 2018-02-02 09:34:19 +00:00
Phillip Webb c3ec316890 Move Application* and *FileWriter classes
Move `ApplicationHome`, `ApplicationPid` and `ApplicationTemp` to the
`system` package. Since `system` package is now much lower level, the
existing `FileWriter` implementations also needed to move to prevent
package tangles.

Fixes gh-8614
2018-02-01 16:44:42 -08:00
Phillip Webb 3ff772957b Add WebServerApplicationContext abstraction
Add a new `WebServerApplicationContext` interface that provides a common
abstraction for all application contexts that create and manage the
lifecycle of an embedded `WebServer`.

Allows server namespaces to become a first-class concept (rather
subverting `ConfigurableWebApplicationContext.getNamespace()`) and
allow us to drop `getServerId()` from `WebServerInitializedEvent`.

Also helps to improve `ManagementContextAutoConfiguration` and
`ManagementContextFactory`.

Fixes gh-11881
2018-02-01 16:38:15 -08:00
Andy Wilkinson 4a1bea1fed Polish 2018-02-01 20:03:02 +00:00
Phillip Webb 7d5e41f7dc Polish 2018-02-01 10:25:33 -08:00
Andy Wilkinson cafe6dbbb1 Suppress debug log output during Logback initialization
Closes gh-11761
2018-02-01 12:48:59 +00:00
Johnny Lim 3cead7693d Polish
Closes gh-11871
2018-02-01 08:35:42 +01:00
Andy Wilkinson a6bb48a2f4 Remove remaining references to no longer supported container versions
Closes gh-11504
2018-01-31 17:29:55 +00:00
Phillip Webb 187c4d728c Merge branch '1.5.x' 2018-01-30 12:47:30 -08:00
Stephane Nicoll f7bf79c9b3 Polish deprecated metadata 2018-01-30 17:45:01 +01:00
Phillip Webb 1a2186e6ef Attempt to fix lambda error detection on JDK 9
Update `LambdaSafe` to also detect `ClassCastException` messages that
start with "module/name".

See gh-11584
2018-01-29 23:05:38 -08:00
Phillip Webb c90a5a9e9e Polish 2018-01-29 21:35:56 -08:00
dreis2211 e7248ff273 Use interfaces for collection declarations
Closes gh-11839
2018-01-29 16:54:11 -08:00
Phillip Webb 3a12f98bab Migrate callbacks to LambdaSafe util
Migrate existing code to the new `LambaSafe` callback handler.

Closes gh-11584
2018-01-29 14:31:10 -08:00
Phillip Webb b0cb728944 Add general utility to deal with lambda callbacks
Add `LambdaSafe` utility that provides a consistent way to deal with
the problems that can occur when calling lambda based callbacks.

See gh-11584
2018-01-29 14:31:10 -08:00
Andy Wilkinson f5102516fa Merge branch '1.5.x' 2018-01-29 20:16:55 +00:00
Andy Wilkinson 244a287484 Merge branch '1.5.x' 2018-01-29 19:51:50 +00:00
Phillip Webb af50a18da9 Polish 2018-01-29 09:47:03 -08:00
Andy Wilkinson 70dabdbf39 Add application/json and /xml to default compressible mime types
Closes gh-11828
2018-01-29 14:33:02 +00:00
Andy Wilkinson 844782b20b Remove default JUL handler to prevent duplicate console logging
By default, JUL configures a single root handler. That handler is a
ConsoleHandler. Previously, we removed all root handlers from JUL but
this is problematic in environments where other handlers are
registered with JUL and those handlers need to be retained.
0679d436 attempted to fix the problem by leaving the root handlers in
place and only adding and removing the bridge handler. This resulted
in log output from Tomcat (and anything else that uses JUL) being
duplicated.

This commit makes another attempt at tackling the problem. It attempts
to detect JUL's default configuration (a single root handler that's a
ConsoleHandler) and only removes the handler if it appears to be from
the default configuration. For environments where default JUL
configuration is being used, this will prevent duplicate logging and
for environments where custom JUL configuration is being used, this
will prevent that configuration from being undone.

Closes gh-8933
2018-01-29 14:22:28 +00:00
dreis2211 a7663c88d3 Replace casted Mockito.any() calls
Closes gh-11817
2018-01-29 07:50:29 +01:00
Johnny Lim 6d68806275 Polish
Closes gh-11805
2018-01-27 05:22:04 +01:00
Phillip Webb b234501af3 Polish 2018-01-26 11:39:41 -08:00
Andy Wilkinson 92138e4c32 Polish "Mark thread as interrupted after catching InterruptedException"
See gh-11784
2018-01-26 15:27:09 +00:00
igor-suhorukov 0c30c969bf Mark thread as interrupted after catching InterruptedException
Closes gh-11784
2018-01-26 15:27:09 +00:00
Stephane Nicoll 1880a25cfb Polish
Closes gh-11788
2018-01-26 12:31:30 +01:00
Stephane Nicoll 584985c7fa Polish 2018-01-26 11:06:11 +01:00
Stephane Nicoll e95cda10ee Add whenInstanceOf to PropertyMapper
Add an operation on PropertyMapper that takes care of casting. Returns
a source for the requested type if the current value is of the right
type.

Closes gh-11788
2018-01-26 11:05:13 +01:00
Stephane Nicoll 3f1aaa1f7e Polish contribution
Closes gh-11783
2018-01-26 10:03:47 +01:00
Raja Kolli 64c324612e Polish
See gh-11783
2018-01-26 09:52:52 +01:00
Phillip Webb adfb6dc128 Polish 2018-01-25 13:20:29 -08:00
Andy Wilkinson 0679d4369c Use uninstall to remove SL4FJBridgeHandler
Closes gh-8933
2018-01-25 16:17:06 +00:00
Andy Wilkinson 11064b5d78 List valid values in failure analysis for enum binding failure
Closes gh-11771
2018-01-25 13:26:43 +00:00
Andy Wilkinson cedb6b2f17 Revert "Clean up the logging system later in context close processing"
This reverts commit 8619256d2a.

See gh-11676
2018-01-25 13:15:41 +00:00
Andy Wilkinson 8619256d2a Clean up the logging system later in context close processing
Previously, the logging system was cleaned up in response to the
root context's ContextClosedEvent being received. This event is
published early in a context's close processing. As a result, the
logging system is in cleaned up state while, for example, disposable
beans are being destroyed.

This commit reworks the logic that triggers logging system clean up
to use a disposable bean instead. Disposable beans are called in
reverse-registration order. The logging clean up bean is registered as
early as possible so that it should be the last disposable bean to
be called.

Closes gh-11676
2018-01-25 10:33:56 +00:00
Phillip Webb d61ba241b5 Move "testdb" naming to DataSourceProperties
Move the "testdb" naming logic to `DataSourceProperties` and expose
the `deduceDatabaseName` method so they can be used in
auto-configuration.

See gh-11719
2018-01-24 20:43:00 -08:00
Stephane Nicoll b67903a04a Keep "testdb" default datasource name internal
Previously, Hikari's pool name was auto-configured with the value of
`spring.datasource.name` that defaults  to `testdb`, which brings some
confusion.

This commit removes the default `testdb` value on
`spring.datasource.name` as it is a sane default only for an embedded
datasource. It is applied whenever applicable instead.

Closes gh-11719
2018-01-24 17:41:32 -08:00
igor-suhorukov 093ca0a687 Use EnumMap whenever possible
Replace regular Map instances with EnumMap to reduce memory consumption.

Closes gh-11760
2018-01-24 16:24:47 -08:00
Phillip Webb ab6ad6aa4b Polish 2018-01-24 16:09:14 -08:00
Brian Clozel be7c0a15f7 Move reactive ErrorAttributes into spring-boot
Closes gh-11714
2018-01-23 11:55:34 +01:00
andrey.onufreyko b19dcb13e2 Replace string arguments with char
Optimize method calls by replacing single character String arguments
with char.

Closes gh-11680
2018-01-22 16:35:06 -08:00
Johnny Lim 768e7c07e6 Polish
Closes gh-11720
2018-01-22 16:06:45 -08:00
dreis2211 5f66c09844 Narrow scope of some variables
Closes gh-11743
2018-01-22 16:01:02 -08:00
Andy Wilkinson 77596fa8e6 Polish 2018-01-22 21:15:48 +00:00
Andy Wilkinson a41e28eea2 Merge branch '1.5.x' 2018-01-22 21:00:26 +00:00
Brian Clozel a8baf42f2f Ensure that CharacterEncodingFilter is ordered first
This commit makes sure that `CharacterEncodingFilter` is ordered with
the `Ordered.HIGHEST_PRECEDENCE` and that other filters, potentially
reading the request body, are ordered after.

In this particular case, both `WebMvcMetricsFilter` and
`ErrorPageFilter` are now ordered at `Ordered.HIGHEST_PRECEDENCE + 1` to
avoid cases where the request body is read before the encoding
configuration is taken into account.

Closes gh-11607
2018-01-22 21:08:21 +01:00
Stephane Nicoll 6aa639253a Analyse the environment for properties that are no longer supported
This commit adds a new `spring-boot-configuration-analyzer` module that
can be added to any app to analyze its environment on startup.

Each configuration key that has a matching replacement is temporarily
transitioned to the new name with a `WARN` report that lists all of
them.

If the project defines configuration keys that don't have a replacement,
an `ERROR` report lists them with more information if it is available.

Closes gh-11301
2018-01-22 17:31:03 +01:00
Johnny Lim a0f6abffb6 Use the platform-specific line separator
Closes gh-11674
2018-01-22 16:11:34 +01:00
Johnny Lim 13a7c9df4b Add missing null checks and volatile keyword
Closes gh-11692
2018-01-22 16:05:11 +01:00
Andy Wilkinson e973eaf2c3 Configure WebClient to use same address (IPv4 or IPv6) as server
Closes gh-11712
2018-01-22 09:47:37 +00:00
Stephane Nicoll 68cc373daa Polish 2018-01-20 11:37:39 +01:00
Phillip Webb 1d39feffea Overhaul actuator endpoint code
Refactor several areas of the actuator endpoint code in order to make
future extensions easier. The primary goal is to introduce the concept
of an `ExposableEndpoint` that has technology specific subclasses and
can carry additional data for filters to use. Many other changes have
been made along the way including:

* A new EndpointSupplier interface that allows cleaner separation of
  supplying vs discovering endpoints. This allows cleaner class names
  and allows for better auto-configuration since a user can choose to
  provide their own supplier entirely.

* A `DiscoveredEndpoint` interface that allows the `EndpointFilter`
  to be greatly simplified. A filter now doesn't need to know about
  discovery concerns unless absolutely necessary.

* Improved naming and package structure. Many technology specific
  concerns are now grouped in a better way. Related concerns are
  co-located and concepts from one area no longer leakage into another.

* Simplified `HandlerMapping` implementations. Many common concerns have
  been pulled up helping to create simpler subclasses.

* Simplified JMX adapters. Many of the intermediary `Info` classes have
  been removed. The `DiscoveredJmxOperation` is now responsible for
  mapping methods to operations.

* A specific @`HealthEndpointCloudFoundryExtension` for Cloud Foundry.
  The extension logic used to create a "full" health endpoint extension
  has been made explicit.

Fixes gh-11428
Fixes gh-11581
2018-01-19 20:44:24 -08:00
Stephane Nicoll c926bed6f5 Polish "Fix modifiers order"
Closes gh-11681
2018-01-19 11:30:30 +01:00
igor-suhorukov e2d05607f2 Fix modifiers order
See gh-11681
2018-01-19 11:30:06 +01:00
Phillip Webb fc29f54868 Make Context implement AnnotationConfigRegistry
Update `AnnotationConfigReactiveWebServerApplicationContext` to
implement `AnnotationConfigRegistry`.

Fixes gh-11686
2018-01-18 23:21:51 -08:00
Phillip Webb f3379668ac Polish 2018-01-18 23:21:51 -08:00
Stephane Nicoll aa748cb0ef Polish "Use System.lineSeparator()""
Closes gh-11665
2018-01-18 16:45:29 +01:00
Johnny Lim d8c83af987 Use System.lineSeparator()
See gh-11665
2018-01-18 16:45:09 +01:00
Andy Wilkinson e1ec0562b2 Revert "Disable Reactor Netty's use of kqueue/epoll"
The failure continued to occur so this commit reverts commit
42c1ce65e9.

See gh-10569
2018-01-18 13:46:27 +00:00
Andy Wilkinson 42c1ce65e9 Disable Reactor Netty's use of kqueue/epoll
There is a suspicion that the use of epoll is causing the intermittent
failures being tracked by gh-10569. This commit disables the use of
epoll to see if it improves the situation.

See gh-10569
2018-01-18 10:18:13 +00:00
Andy Wilkinson 87182a3a2b Stop configuring the Logback console appender to use UTF-8
Previously, the default Logback configuration set the console
appenders charset to UTF-8. This was inconsistent with the Logback
file appender and Log4j2's console and file appenders, all of which
used the platform's default.

This commit removes the configuration of the Logback console
appender's charset. This means that it will use the platform's
default charset, aligning it with the Logback file appender and
both Log4j2 appenders.

Closes gh-11611
2018-01-17 19:07:34 +00:00
Andy Wilkinson 54c0cf513b Polish 2018-01-17 19:03:23 +00:00
Andy Wilkinson 3904f49c9f Configure ServletContext before initializing S…C…Initializer beans
Previously, the ServletContext was configured after any
ServletContextInitializer beans had been initialized. This meant that
any configuration class that provided such a bean would be initialized
before the ServletContext was configured. If the configuration class
used the ServletContext in its initializtaion that it would see it in
its default, unconfigured state.

This commit reworks the configuration of the ServletContext so that
it happens before any ServletContextInitializer beans are initialized.

Closes gh-10699
2018-01-17 17:32:23 +00:00
Andy Wilkinson d8b3c7cc3c Make AnnotationConfigSWSApp…Context implement AnnotationConfigRegistry
Closes gh-11658
2018-01-17 17:30:16 +00:00
Andy Wilkinson 67a299020b Rework mappings endpoint
Improve the structure of the response and include mappings from
WebFlux and Servlet and Filter registrations in addition to the
mappings from Spring MVC.

Closes gh-9979
2018-01-16 18:26:59 +00:00
Brian Clozel 381d759ef1 Support server.compression with reactive servers
This commit adds support for HTTP compression with reactive servers,
with the following exceptions:

* `server.compression.mime-types` and
`server.compression.exclude-user-agents` are not supported by Reactor
Netty at the moment

* `server.compression.min-response-size` is only supported by Reactor
Netty right now, since other implementations rely on the
`"Content-Length"` HTTP response header to measure the response size
and most reactive responses are using `"Transfer-Encoding: chunked"`.

Closes gh-10782
2018-01-16 16:01:34 +01:00
Stephane Nicoll 76057be9ac Merge branch '1.5.x' 2018-01-16 11:15:51 +01:00
Andy Wilkinson 23d8d608c4 Polish 2018-01-15 13:35:46 +00:00
Johnny Lim 77150f8dc9 Polish
Closes gh-11630
2018-01-15 10:20:31 +01:00
Johnny Lim f6780bed65 Remove an unnecessary assertion
Closes gh-11622
2018-01-14 09:31:11 +01:00
Andy Wilkinson 2b99962a85 Replace use of Date with OffsetDateTime and Instant in Actuator
Closes gh-10976
2018-01-12 17:26:05 +00:00
Stephane Nicoll 8aaf95b792 Polish 2018-01-12 11:40:35 +01:00
Johnny Lim 136e26e307 Fix typo in DynamicRegistrationBean class name
Closes gh-11606
2018-01-12 01:44:45 +01:00
Andy Wilkinson a051e30fe0 Publish an event after refresh but before runners are called
This commit partially reverts the changes made in ec470fbe. While
the started message continues to be logged before any application and
command line runners are called, the publishing of
ApplicationReadyEvent now happens after the runners have been called.
Additionally, a new event, named ApplicationStartedEvent, has been
introduced. This new event is published after the context has been
refreshed but before any application and command line runners are
called.

Closes gh-11484

The reworking of the events described above also means that either
an ApplicationReadyEvent or an ApplicationFailedEvent will be
published and the latter should never be published once the former
has been published.

Closes gh-11485
2018-01-11 11:26:53 +00:00
Brian Clozel 6ecdd6e9c1 Add SSL client Auth support with Reactor Netty
This commit adds SSL client Authentication support
to Reactor Netty and adds the relevant tests to
`AbstractReactiveWebServerFactoryTests` for all servers.

Fixes gh-11488
2018-01-11 11:15:29 +01:00
Brian Clozel 98ac2218db Apply server.undertow.* config to reactive servers
This commit applies `server.undertow.*` configuration properties
to Undertow when configured as a reactive web server.

See gh-11500
2018-01-11 11:15:23 +01:00
Brian Clozel 15bc718248 Apply server.jetty.* config to reactive servers
This commit applies `server.jetty.*` configuration properties
to Jetty when configured as a reactive web server.

It also removes some infrastructure support for Jetty 8, which
is not supported anymore in Spring Boot 2.0 (partial fix for
gh-11504).

See gh-11500
2018-01-11 11:15:17 +01:00
Brian Clozel d264af8142 Apply server.tomcat.* config to reactive servers
This commit applies most `server.tomcat.*` configuration
properties to Tomcat when set up as a reactive web server.

Some Servlet-specific properties are not applied:

* server.tomcat.additional-tld-skip-patterns
* server.tomcat.redirect-context-root
* server.tomcat.use-relative-redirects

Fixes gh-11334
2018-01-11 11:15:02 +01:00
Andy Wilkinson 2059922735 Make ContextIdApplicationContextInitializer produce unique IDs
Closes gh-11023
2018-01-10 12:53:03 +00:00
Madhura Bhave e57aafd63d Provide EndpointRequest for WebFlux-based Security
Closes gh-11022
2018-01-09 16:06:36 -08:00
Phillip Webb b078698f20 Update copyright year of changed files 2018-01-09 12:13:27 -08:00
Phillip Webb b3ec2c9d1d Polish 2018-01-09 12:12:59 -08:00
Johnny Lim b8706c47d6 Use instance equality for Class
Closes gh-11534
2018-01-09 09:30:36 +01:00
Johnny Lim 0f0c6e0729 Polish
Closes gh-11536
2018-01-09 09:28:56 +01:00
Phillip Webb 9cb5f3da89 Create DynamicRegistrationBean
Extract functionality from the `RegistrationBean` into a new class
designed to work with dynamic registration. Servet and Filter
registration beans now extend from `DynaimcRegistrationBean`, where as
`ServletListenerRegistrationBean` extends directly from
`RegistrationBean`.

This refactor allows the removal of `ServletListenerRegistrationBean`
deprecated methods.

Fixes gh-11344
2018-01-08 22:05:00 -08:00
Phillip Webb 79fc8838fd Propagate Map conversion failures
Align `MapBinder` with `IndexedBinder` so that if a value is specified
any converter exception are propagated.

See gh-11493
2018-01-08 15:19:06 -08:00
Phillip Webb 25609c060e Polish 2018-01-08 15:19:06 -08:00
Phillip Webb a62a27e686 Polish InvalidConfigurationPropertyValueException 2018-01-08 15:05:52 -08:00
Phillip Webb 937a62e0b8 Polish ConfigurationPropertiesBinder
Remove unused code and polish implementation so that the binder is not
created on each invocation.
2018-01-08 15:05:52 -08:00
Madhura Bhave 41c02b307b Try to convert value in MapBinder
Fixes gh-11493
2018-01-08 10:17:55 -08:00
Andy Wilkinson 927003e0b7 Polish 2018-01-08 13:59:14 +00:00
Stephane Nicoll 8941dc746e Polish 2018-01-08 14:38:10 +01:00
Stephane Nicoll b98c7ed9f8 Add InvalidConfigurationPropertyValueException
This commit adds a new exception type that denotes the value of a
configuration key is invalid, alongside a FailureAnalyzer that reports
a human-readable report when such exception is thrown on startup.

ResourceNotFoundException being a (useless) specialization of this new
exception, its usage has been refactored to use the more general
exception type.

Closes gh-10794
2018-01-08 14:24:57 +01:00
Stephane Nicoll 6daad1f562 Allow to inject the Environment in FailureAnalyzer
Closes gh-11569
2018-01-08 14:24:23 +01:00
Stephane Nicoll 71aad04ea9 Update copyright header 2018-01-06 17:42:21 +01:00
Johnny Lim 67a5144112 Remove unnecessary condition in ConfigurationPropertyName
Closes gh-11486
2018-01-06 17:40:55 +01:00
Brian Clozel 11d4426b4d Provide client factory with supplier in RestTemplateBuilder
This commit removes
`RestTemplateBuilder.requestFactory(ClientHttpRequestFactory factory)`
because it can be misleading. This builder class is meant to be
immutable, but calling that method and then timeout related ones will
affect the `ClientHttpRequestFactory` instance.

Instead, this method is replaced with a
`Supplier<ClientHttpRequestFactory>` that is called every time a
`RestTemplate` is being built.

That approach may reduce the reusability of request factories, but it is
much more consistent.

Closes gh-11255
2018-01-05 16:29:18 +01:00
Stephane Nicoll ac004eabf3 Update copyright header
See gh-11510
2018-01-05 10:30:43 +01:00
Johnny Lim 37d8eedae3 Polish
Closes gh-11510
2018-01-05 10:29:22 +01:00
Phillip Webb bee5fa7fc6 Polish 2018-01-03 13:24:04 -08:00
Phillip Webb 37fe7bc8f6 Update validator background initializer
Update the validator background initializer to actually create
the validator.

Closes gh-11412
2018-01-03 13:19:31 -08:00
Brian Clozel 3ab32df242 Add support for HTTP/2 in Jetty with Conscrypt
This commit configures Jetty for HTTP/2 support as soon as the following
conditions are met:

* `server.http2.enabled=true`
* Both `org.eclipse.jetty:jetty-alpn-conscrypt-server` and
`org.eclipse.jetty.http2:http2-server` are on classpath

This will use the Conscrypt library for ALPN and TLS support using
native libraries shipped within the Conscrypt uber Jar. This does not
require a JVM agent or patching the JDK classes.

Closes gh-10902
2018-01-03 17:43:32 +01:00
Brian Clozel 8286cbc9f3 Merge branch '1.5.x' 2018-01-02 16:13:11 +01:00
Johnny Lim a462255383 Polish
Closes gh-11451
2018-01-01 08:41:09 +01:00
dreis2211 67a84cd4f9 Fix typos
Closes gh-11450
2018-01-01 08:37:42 +01:00
Madhura Bhave 8102dc78cb Remove redundant throws declarations 2017-12-29 12:10:13 -08:00
Stephane Nicoll 106642a8d4 Polish 2017-12-29 14:48:24 +01:00
Stephane Nicoll 2bd8c2bfca Polish
See gh-11181
2017-12-28 12:52:40 +01:00
Johnny Lim 8f7ab95e0e Use BufferedReader.lines()
Closes gh-11436
2017-12-27 16:44:27 +01:00
Johnny Lim e32287164b Use Supplier version of Assert.state()
Closes gh-11362
2017-12-23 14:31:38 +01:00
Johnny Lim 4cc598ac5e Replace contains() with indexOf()
Closes gh-11373
2017-12-23 14:00:27 +01:00
Johnny Lim e4f0ad2165 Polish
Closes gh-11372
2017-12-23 13:11:53 +01:00
Phillip Webb ad1c8d773f Start properties validator in background thread
Change the default JSR-303 validator used by the configuration
properties binder so that it's initialized in a background thread.
This change allows the context to carry on loading additional beans
whilst the validator is initializing.

Fixes gh-11412
2017-12-22 21:16:47 -08:00
Phillip Webb 5f10c82284 Change property mapper to use array returns
Update the `PropertyMapper` interface to return arrays rather than
Lists. Since implementations are package-private it's possible for us
to control how they are used and it helps to save a little memory.

Fixes gh-11411
2017-12-22 20:57:38 -08:00
Phillip Webb 2efa21c570 Make hot methods in-line friendly
Refactor a few hot methods so that they are more likely to be in-lined
by the JIT.

Fixes gh-11409
2017-12-22 20:55:47 -08:00
Phillip Webb e141f77801 Share BinderConversionService with a static
Use a single shared static `BinderConversionService` instance for all
created binders to save memory and improve performance.

Fixes gh-11352
2017-12-22 20:54:00 -08:00
Phillip Webb c024313141 Drop environment variable "__" list support
Remove support for the `__` environment variable list shortcut in order
to reduce complexity. The shortcut was developed before the new `Binder`
code was fully formed and isn't really necessary now since comma-lists
can be converted automatically.

Fixes gh-11410
2017-12-22 12:15:12 -08:00
dreis2211 00d12c5b2d Align 'behavior' spelling to style guide
Closes gh-11394
2017-12-22 18:15:19 +01:00
Phillip Webb 241a7086c0 Add PropertyMapper utility class
Add a utility class that can help when mapping values from
`@ConfigurationProperties` to a third-party class.

See gh-9018
2017-12-15 18:32:06 -08:00
Stephane Nicoll 22aeb74d73 Polish 2017-12-14 08:40:03 +01:00
Phillip Webb ed2460b091 Add support for animated GIFs
Update ImageBanner to support animated GIFs. Animations rely on ANSI
cursor codes so don't work so well in an IDE. They do, however, work
when running the app from a terminal.

See also commit 47bc5e71ab

Closes gh-11118
2017-12-13 14:58:11 -08:00
Phillip Webb 3273859fde Polish 2017-12-13 14:32:55 -08:00
Phillip Webb 5ca608330c Merge branch '1.5.x' 2017-12-13 13:07:18 -08:00
Stephane Nicoll a626f5462d Consistent use of @AliasFor
Closes gh-10836
2017-12-13 14:42:16 +01:00
Stephane Nicoll e5361d887c Relocate banner properties to spring.banner
Closes gh-11339
2017-12-13 12:01:23 +01:00
Johnny Lim de72f2ae32 Polish
Closes gh-11327
2017-12-13 09:38:20 +01:00
Stephane Nicoll 23218add90 Polish 2017-12-12 11:57:30 +01:00
Stephane Nicoll 408368a1f9 Polish "Allow graceful shutdown of Atomikos"
Closes gh-11237
2017-12-12 08:30:24 +01:00
nklmish 46d94aba4f Allow graceful shutdown of Atomikos
See gh-11237
2017-12-12 08:18:42 +01:00
Johnny Lim 96250743b5 Add missing "abstract" keywords
Closes gh-11303
2017-12-09 15:29:15 -08:00
Johnny Lim 6d54072e04 Remove "final" keywords
Closes gh-11294
2017-12-08 11:13:07 -08:00
Stephane Nicoll bd7bd6edc8 Fix session timeout conversion for Undertow
Closes gh-11283
2017-12-07 16:48:42 -08:00
Andy Wilkinson 953d69ce0b Polish "Fix system properties in file-appender.xml"
Closes gh-11232
2017-12-06 15:31:06 +00:00
Johnny Lim d4d6a43fc2 Fix system properties in file-appender.xml
See gh-11232
2017-12-06 15:30:57 +00:00
Andy Wilkinson 54369a72ca Polish "Use LoggingSystemProperties constants"
Closes gh-11240
2017-12-06 15:00:29 +00:00
Johnny Lim 4c5de416ef Use LoggingSystemProperties constants
See gh-11240
2017-12-06 15:00:20 +00:00
Johnny Lim 2c204f2154 Polish
Closes gh-11242
2017-12-02 09:03:59 +01:00
Andy Wilkinson e16579b416 Support Integer to Duration conversion during property binding
Closes gh-11216
2017-11-30 12:30:42 +00:00
Johnny Lim 44299bb980 Polish
Closes gh-11206
2017-11-29 09:37:36 -08:00
Phillip Webb d7251f52a4 Polish 2017-11-29 09:09:53 -08:00
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
Henrik 7728f8fde6 Introduce configurable logging.pattern.dateformat
Add configurable logger dateformat support for Logback and Log4j2.

Closes gh-8516
2017-11-02 23:22:15 -07:00
Phillip Webb f0327fbd0d Polish SizeAndTimeBasedRollingPolicy changes
Closes gh-6352
2017-11-02 15:21:14 -07:00
Vedran Pavic 991468b0ef Use SizeAndTimeBasedRollingPolicy file appender
Update the logback file appender to use `SizeAndTimeBasedRollingPolicy`
rather than `FixedWindowRollingPolicy`.

Add two new properties to improve log file configuration capabilities:

 - `logging.file.max-history` to limit the number of archive log files
    to keep.
 - `logging.file.max-size` to limit the log file size.

See gh-6352
2017-11-02 15:18:16 -07:00
Andy Wilkinson 8eae372433 Change handling of spring.config.location so it replaces defaults
Previously, spring.config.name was handled in such a way that its
value would replace the defaults. By constrast, spring.config.location
would add to the defaults.

Update the handling of spring.config.location so that it replaces the
defaults. This aligns its behaviour with spring.config.name. To allow
users to add additional locations a new property,
spring.config.additional-location, has been introduced. It behaves as
spring.config.location did prior to this change.

Closes gh-10595
2017-11-02 17:12:22 +00:00
Stephane Nicoll e28b98c59d Remove multi config runApplication extension
Closes gh-10511
2017-11-02 12:04:22 +01:00
Phillip Webb c55b5d7111 Polish 2017-11-01 23:14:52 -07:00
Brian Clozel 6bfbcc291a Add NettyServerCustomizer for Reactor Netty support
This commit adds a new customizer interface, `NettyServerCustomizer` for
customizing Reactor Netty server instances while they're being built.

Closes gh-10418
2017-10-30 17:50:47 +01:00
Andy Wilkinson ec470fbe59 Call Application and CommandLine Runners after ready event
Closes gh-7656
2017-10-30 16:41:18 +00:00
Stephane Nicoll 4dcc354f86 Merge branch '1.5.x' 2017-10-30 16:31:50 +01:00
Andy Wilkinson 88f869bf06 Remove misleading setters from ConfigurationPropertiesBindingPostProcessor
Previously, ConfigurationPropertiesBindingPostProcessor had a number
of setter methods that implied that its configuration was more mutable
than it actually is and would only have an effect when called early
on in the post-processor's lifecycle.

This commit clarifies how the post-processor can be configured by
removing the misleading setters.

Closes gh-10598
2017-10-27 21:44:12 +01:00
Andy Wilkinson 85b1511085 Make configuration properties binding always uses current environment
Previously, configuration properties binding would only see changes to
the environment if there was no PropertySourcesPlaceholderConfigurer
in the context. This happened because
PropertySourcesPlaceholderConfigurer wrapped the Environment in a
PropertySource, effectively hiding it from the change tracking
performed by SpringConfigurationPropertySources.

This commit updates ConfigurationPropertiesBindingPostProcessor so
that it ignores the environment property source contained by
PropertySourcesPlaceholderConfigurer and uses a composite of
the PropertySourcesPlaceholderConfigurer's other property sources and
the Environment's PropertySources instead.
2017-10-27 21:29:09 +01:00
Stephane Nicoll fd07bfd816 Polish "Add runApplication() Kotlin top level function"
Closes gh-10511
2017-10-27 14:22:15 +02:00
Sebastien Deleuze baffecdb14 Add runApplication() Kotlin top level function
Since Kotlin extensions do not apply to static
methods, this commit introduces a runApplication()
Kotlin top level function that acts as a Kotlin
shortcut for SpringApplication.run().

This shortcut avoids to require using non-idiomatic
code like SpringApplication.run(FooApplication::class.java)
and provides a runApplication<FooApplication>() alternative
(as well as an array of KClass based alternative when
multiple classes need to be passed as parameter).

It is possible to customize the application with the
following syntax:

runApplication<FooApplication>() {
    setEnvironment(environment)
}

See gh-10511
2017-10-27 14:18:24 +02:00
Stephane Nicoll b720c2141c Rename DatabaseInitialization to DataSourceInitialization
Closes gh-10779
2017-10-26 16:26:08 +02:00
Stephane Nicoll 3412ee62d5 Make @Validated a hard requirement for JSR-303 validation
Closes gh-8024
2017-10-25 17:43:18 +02:00
Stephane Nicoll b23f68b0d5 Merge branch '1.5.x' 2017-10-25 13:59:54 +02:00
Madhura Bhave 2e3187d1f6 Null values from yaml should be stored as empty string
When building a flattened map, the YamlProcessor from
Spring Framework, converts a null value to an empty string.
We want the null value to also keep track of its origin,
which is why this commit creates an `OriginTrackedValue`
for an empty string if the original value is null.

Fixes gh-10656
2017-10-24 14:57:22 -07:00
Andy Wilkinson 2b426c30a6 Polish “Remove explicit type arguments”
Closes gh-10494
2017-10-24 14:44:26 +01:00
Johnny Lim 6168fae720 Remove explicit type arguments
See gh-10494
2017-10-24 14:44:20 +01:00
Andy Wilkinson a256602c7b Polish 2017-10-24 14:41:03 +01:00
Stephane Nicoll 76c4819053 Remove internal configuration properties validator cleanup
This commit removes the cleanup of the javax.validator.Validator that
can be created to validate @ConfigurationProperties binding as the
memory effect can no longer be reproduced.

Closes gh-10573
2017-10-24 10:05:52 +02:00
Stephane Nicoll c2f649df54 Add support for JPA mapping resources
Closes gh-10684
2017-10-19 17:35:38 +02:00
Andy Wilkinson 77cbab794e Make TomcatEmbeddedWebappClassLoader parallel capable
Closes gh-10477
2017-10-17 16:04:27 +01:00
Andy Wilkinson 688da652ac Polish 2017-10-17 15:41:55 +01:00
Stephane Nicoll 2eba1c5f62 Polish "Use Assert.state() with Supplier where possible"
Closes gh-10658
2017-10-17 15:36:51 +02:00
dreis2211 3b71393e0a Use Assert.state() with Supplier where possible
See gh-10658
2017-10-17 15:35:59 +02:00
Stephane Nicoll 22de4303c5 Polish "When pool autocommit is disabled, inform Hibernate"
Closes gh-9737
2017-10-17 11:39:44 +02:00
Craig Andrews d0e70e90de When pool autocommit is disabled, inform Hibernate
Starting with Hibernate 5.2.10, the JPA property
`hibernate.connection.provider_disables_autocommit` should be set to true
when the datasource has autocommit disabled in order to improve
performance.

See gh-9737
2017-10-17 09:19:47 +02:00
Brian Clozel 81d1b3c6ee Build against Spring Framework 5.0.1.BUILD-SNAPSHOT
See gh-10587
2017-10-12 15:52:11 +02:00
Andy Wilkinson 273defdb1f Merge branch '1.5.x' 2017-10-12 14:40:02 +01:00
Phillip Webb 97afe8e938 Fix package tangle in properties source
Update `SpringConfigurationPropertySource` so that it no longer
references types in `org.springframework.boot.env`.

Closes gh-10592
2017-10-11 11:24:46 -07:00
Phillip Webb f48550aa44 Fix package tangle in binder
Update the `BinderConversionService` so that it no longer references
classes from `org.springframework.boot.context.properties.bind`.

See gh-10592
2017-10-11 11:23:14 -07:00
Andy Wilkinson bcfb1d17b1 Merge branch '1.5.x' 2017-10-11 16:19:25 +01:00
Phillip Webb f337323819 Allow recursive binding in Maps
Update `Binder` so that Maps containing references to themselves may
be bound. The existing stack-overflow protection (required when binding
a bean to a non enumerable source) now only applies to bean properties.

Fixes gh-9801
2017-10-10 21:41:53 -07:00
Madhura Bhave 3ec3b64d45 Guard against binding non-instantiable types
Update `JavaBeanBinder` so that null instances that are non-instantiable
are not bound.

Fixes gh-10131
2017-10-10 17:55:35 -07:00
Madhura Bhave b7c37c2807 Expose webServer from ReactiveWebServerApplicationContext
Closes gh-9746
2017-10-10 14:51:11 -07:00
Phillip Webb b3555fa5c5 Fix checkstyle violation in properties file
See gh-10565
2017-10-10 13:48:33 -07:00
Thiago Hirata 85e71f2373 Update OriginTrackedPropertiesLoader to ISO 8859-1
Align `OriginTrackedPropertiesLoader` with Java default property loading
by using ISO 8859-1 character encoding.

Closes gh-10565
2017-10-10 12:31:43 -07:00
Phillip Webb 748e0779b6 Update copyright year for changed files 2017-10-10 11:56:13 -07:00
Phillip Webb b87f9c11f1 Fix POMs for the updated build/release process
Fix POMs following project relocations and apply CI friendly Maven
conventions.

See gh-9316
2017-10-04 16:34:38 -07:00
Phillip Webb 0ba4830b4f Relocate projects to spring-boot-project
Move projects to better reflect the way that Spring Boot is released.

The following projects are under `spring-boot-project`:

  - `spring-boot`
  - `spring-boot-autoconfigure`
  - `spring-boot-tools`
  - `spring-boot-starters`
  - `spring-boot-actuator`
  - `spring-boot-actuator-autoconfigure`
  - `spring-boot-test`
  - `spring-boot-test-autoconfigure`
  - `spring-boot-devtools`
  - `spring-boot-cli`
  - `spring-boot-docs`

See gh-9316
2017-10-04 16:34:23 -07:00