Commit Graph

2330 Commits

Author SHA1 Message Date
Andy Wilkinson 41424e4529 Merge branch '1.5.x'
Closes gh-10457
2017-10-02 15:24:12 +01:00
Johnny Lim bfa291f671 Polish 2017-10-02 15:07:03 +01:00
Andy Wilkinson 9102eb32d1 Polish 2017-10-02 13:34:32 +01:00
Andy Wilkinson 30727ab145 Merge branch '1.5.x' 2017-10-02 12:49:13 +01:00
Andy Wilkinson 858b092a87 Make servlet context property source available before refresh
Previously, when deploying a Spring Boot application to a container,
the servlet context property source was not fully initialised until
the context was refreshed. This led to a problem where a value from a
property source with lower precedence would be seen during the early
stages of the application starting. Once the servlet context property
source had been initialized, its value for the property would then
become visible effectively making it appear as if the property's
value had changed during startup. This led to a specific problem
with determining active profiles.

If spring.profiles.active was set both in JNDI and via the servlet
context both profiles would end up being active, rather than the
more intuitive behaviour of the profiles made active via the servlet
context overriding those made active via JNDI.

This commit updates SpringBootServletInitializer so that it explicitly
creates the StandardServletEnvironment and initializes its property
sources using the servlet context. This is done before the application
is created and run, thereby ensuring that the servlet context
property source is available throughout the application's startup.

Closes gh-9972
2017-10-02 12:38:59 +01:00
dreis2211 38813edc23 Replace some loops with removeIf()
Closes gh-10469
2017-10-02 09:08:34 +02:00
dreis2211 f72c04286b Remove redundant toString() calls
Closes gh-10467
2017-10-02 09:02:43 +02:00
dreis2211 756398b52c Replace some String.length() checks with String.isEmpty()
Closes gh-10451
2017-09-30 10:42:48 +02:00
Andy Wilkinson 082258952a Fall back to JVM's class path when finding jars with static resources
Previously, StaticResourceJars would only find jars with
META-INF/resources content if it had been loaded by a URLClassLoader.
This is not the case on Java 9 and, as a result, static content in
META-INF/resources of any jars on the class path was not found.

This commit updates StaticResourceJars to fall back to using the
JVM's class path to find static resource jars when it was loaded by
a ClassLoader that is not a URLClassLoader.

Closes gh-10455
2017-09-29 12:38:37 +01:00
Phillip Webb 93f6168fd0 Polish 2017-09-28 07:54:22 -07:00
Stephane Nicoll 0ccd57285f Move JavaVersion to a reusable location. 2017-09-28 14:05:26 +02:00
Phillip Webb 9e43b99966 Polish 2017-09-27 17:44:48 -07:00
Stephane Nicoll c2c6f49cbc Improve output of `/application/env/{propertyName}`
This commit changes the output of a single property to mention the
actual value in the environment as well as the property source that
contributed to the value.

Closes gh-10178
2017-09-27 10:48:17 +02:00
Stephane Nicoll eb045f1da1 Fix value of property in PropertySource descriptor
Prior to this commit, if a key was present in multiple PropertySources,
all descriptors shared the same common value. This commit makes sure
that each PropertySource descriptor shows the value it defines rather
than the one that is promoted in the Environment.

Closes gh-10428
2017-09-26 18:16:53 +02:00
dreis2211 f3472beed8 Remove redundant semicolons
Closes gh-10422
2017-09-26 08:38:43 +02:00
Andy Wilkinson f0693989f1 Polish 2017-09-23 07:02:59 +01:00
Andy Wilkinson ae1f95e6d2 Start building against Spring Framework snapshots for 5.0.0.RELEASE
See gh-10325
2017-09-23 06:58:33 +01:00
Andy Wilkinson bb3f32fa2b Add a generic to DataSourceBuilder
Closes gh-7942
2017-09-21 15:50:12 +01:00
Madhura Bhave 4a740a16f3 Duplicate values should bind properly to List
Fixes gh-10106
2017-09-19 13:58:51 -07:00
Stephane Nicoll 0f2d91c7e0 Fix broken build
Hibernate Validator 6 has a slightly different structure for default
messages. This commit adapts our tests accordingly.

See gh-9969
2017-09-19 19:19:36 +02:00
Raja Kolli a4a0eef186 Upgrade to Hibernate Validator 6.0.2.Final
Closes gh-9969
2017-09-19 17:40:45 +02:00
Madhura Bhave 114d270c9f Use date that fails with the fallback formatter
Fixes gh-9975
2017-09-18 16:39:28 -07:00
Andy Wilkinson d1cf308bd2 Polish 2017-09-18 19:26:19 +01:00
Phillip Webb 324a00fd6d Polish 2017-09-14 18:33:03 -07:00
Phillip Webb 0e32c0a7bc Fix speed regression in property binding
Update `MapBinder` to only compute values if an entry does not already
exist. Prior to this commit, a binding to `Map<String,List<String>>`
would be expensive since the same entries would be bound many times.

For example, given:

	foo.bar[0]=baz1
	foo.bar[1]=baz1
	foo.bar[2]=baz1

The Map binder would iterate over the properties `bar[0]`, `bar[1]` and
`bar[2]`. Each of these properties resulted in the same actual key of
`bar` which would then be bound to list multiple times.

Fixes gh-10093
2017-09-14 16:03:57 -07:00
Phillip Webb 402dcb7ea4 Polish 2017-09-14 15:24:14 -07:00
Stephane Nicoll 5efcbad751 Polish 2017-09-14 19:22:37 +02:00
Jon Schneider c2958c27ab Replace Boot's own metrics with support for Micrometer
Closes gh-9970
2017-09-14 17:15:46 +01:00
Johnny Lim bd2d08bcd0 Polish
Closes gh-10282
2017-09-14 15:13:51 +02:00
Brian Clozel 485d0ed8be Polish
Release allocated `DataBuffer` if an error happens during template
processing. Otherwise, this buffer will be automatically released when
written to the exchange.
2017-09-14 10:06:34 +02:00
Spring Buildmaster 30eb937a83 Next Development Version 2017-09-12 10:54:22 +00:00
Phillip Webb 46dfe38b60 Rework security request matchers
Update the security request matchers so that a bean is no longer needed
when the matcher is used. Matchers can now be build by starting from
the `EndpointRequest` or `StaticResourceRequest` classes. For example:

http.authorizeRequests()
  .requestMatchers(EndpointRequest.to("status", "info")).permitAll()
  .requestMatchers(EndpointRequest.toAnyEndpoint()).hasRole("ACTUATOR")
  .requestMatchers(StaticResourceRequest.toCommonLocations()).permitAll()

Closes gh-7958
2017-09-12 00:11:29 -07:00
Phillip Webb 2e51b48cd9 Refactor actuator package locations
Restructure actuator packages to improve structure. The following
changes have been made:

 - Separate actuator and actuator auto-configuration into different
   modules.
 - Move endpoint code into `spring-boot-actuator`.
 - Move `Endpoint` implementations from a single package into
   technology specific packages.
 - Move `HealthIndicator` implementations from a single package into
   technology specific packages.
 - As much as possible attempt to mirror the `spring-boot` package
   structure and class naming in `spring-boot-actuator` and
   `spring-boot-actuator-autoconfigure`.
 - Move `DataSourceBuilder` and DataSource meta-data support from
   `spring-boot-actuator` to `spring-boot`.

Fixes gh-10261
2017-09-12 00:11:20 -07:00
Andy Wilkinson c06de245d9 Allow endpoints to be mapped to /
This commit removes the restriction that was added in 4a61e45 to
prevent / from being used as the management context path when the
management context was not using a different port

The management context path can now be set to / irrespective of the
configuration of the management port. To avoid a possible clash
with the application's welcome page or similar, the links "endpoint"
that is mapping to the management context path is disabled when
the management context path is /.

As part of allowing / to be used as the management context path again,
the handling of endpoint mappings and the creation of paths for
individual operations has been consolidated into a new EndpointMapping
class that is used across the three (MVC, WebFlux, and Jersey)
implementations.

See gh-9898
2017-09-08 09:38:41 +01:00
Andy Wilkinson 2e19f0b3e5 Upgrade to Jersey 2.26
Closes gh-10217
2017-09-07 20:09:24 +01:00
Johnny Lim 30262e3bc1 Polish
Closes gh-10168
2017-09-06 12:52:24 +02:00
Andy Wilkinson beb257f452 Rework JettyEmbeddedErrorHandler to support Jetty 8
Closes gh-10175
2017-09-06 09:51:22 +01:00
Andy Wilkinson f1c5fc41b4 Polish 2017-09-05 12:52:38 +01:00
Stephane Nicoll 5111b03aa3 Remove duplicated method
This commit removes the beanNamesForAnnotationIncludingAncestors
method as it is now part of Spring Framework's BeanFactoryUtils.

Closes gh-10150
2017-09-05 09:51:33 +02:00
Stephane Nicoll 0e21af4082 Fix typo 2017-09-05 09:10:52 +02:00
Stephane Nicoll 67fc5ca433 Create a public API to bind a ConfigurationProperties object
Previously, the API used to bind a ConfigurationProperties annotated
object was private to the BeanPostProcessor implementation.

This commit moves most of the logic to ConfigurationPropertiesBinder. As
we want this object to have the same state regardless of how it is built,
a builder is now provided that detects the components that the binder
needs if not specified explicitly.

Closes gh-8344
2017-09-05 08:51:01 +02:00
Stephane Nicoll ab82aed96a Improve configuration properties binding test coverage
See gh-8344
2017-09-04 12:01:07 +02:00
Stephane Nicoll 11edff7576 Discover endpoints in parent context
Closes gh-10144
2017-09-01 16:45:52 +02:00
Andy Wilkinson f49741e3ed Allow an operation to specify the media types that it produces
Closes gh-10118
2017-08-31 13:56:15 +01:00
Phillip Webb 9cb0a81e50 Polish adapt to and from Mono conversion
See gh-10112
2017-08-30 15:38:05 -07:00
Andy Wilkinson 7fc12bc8a3 Polish 2017-08-30 17:34:07 +01:00
Stephane Nicoll afda0ec129 Default Hibernate DDL auto to none with Flyway/Liquibase
This commit adds a strategy interface to specific if a given DataSource
has its schema managed. The Hibernate auto-configuration uses it to set
it to "none" if a mechanism to initialize the DataSource is
found and "create-drop" otherwise.

Both Flyway and Liquibase implements that strategy interface and
register it in the context accordingly.

Closes gh-9262
2017-08-30 12:42:24 +02:00
Andy Wilkinson 8babd5d4c5 Adapt to and from Mono when calling an operation on an endpoint
This commit adds support for adapting to and from Mono when calling
an operation on an endpoint.

When an endpoint is exposed using WebFlux, a call to a blocking
operation is adapted to return a Mono by dispatching the operation
invocation on a separate thread using Reactor's elastic scheduler.

When an endpoint is exposed using Jersey, a call to an endpoint that
returns a Mono is adapted to return the Mono's result by blocking
until it is available. Note that such adaptation is not necessary when
using Spring MVC as it supports Mono natively.

Closes gh-10112
2017-08-30 10:53:07 +01:00
Stephane Nicoll b91ceef621 Polish "Polish"
Closes gh-10109
2017-08-30 10:41:51 +02:00
Johnny Lim db76112700 Polish
See gh-10109
2017-08-30 10:33:53 +02:00