Commit Graph

1536 Commits

Author SHA1 Message Date
Phillip Webb
dba8ef2ba8 Polish CF management skip SSL opt-in
See gh-7629
See gh-7655
2016-12-20 18:25:32 -08:00
Madhura Bhave
34712cbf76 Switch CF management skip SSL to opt-in
Change CloudFoundryActuatorAutoConfiguration so that skipping of SSL
verification is now opt-in rather than enabled by default.

Fixes gh-7629
Closes gh-7655
2016-12-20 18:24:15 -08:00
Phillip Webb
06a7ab0cd5 Polish ReservoirFactory support
Polish Dropwizrd reservoir support including a refactor of
`ReservoirFactory` to allow reservoirs to be created based on a
metric name.

See gh-5199
See gh-7105
2016-12-20 15:12:14 -08:00
Lucas Saldanha
1fc2e87053 Enable custom Reservoir with Dropwizard metrics
Uses the ReservoirFactory to customize the implementation of
the Reservoir that will be used when creating Timer and Histogram
in the DropwizardMetricServices.

Fixes gh-5199
Closes gh-7105
2016-12-20 14:56:29 -08:00
Phillip Webb
d15f3548be Polish 2016-12-19 13:12:03 -08:00
Phillip Webb
6121208cbb Polish formatting 2016-12-19 12:47:03 -08:00
Phillip Webb
4b9cba351b Merge branch '1.4.x' into 1.5.x 2016-12-19 12:36:57 -08:00
Phillip Webb
bd74c3d327 Polish formatting 2016-12-19 12:25:09 -08:00
Stephane Nicoll
684be0f048 Polish contribution
Closes gh-6852
2016-12-16 14:19:20 +01:00
Vedran Pavic
899f7aa8f0 Add constants for supported audit event types
See gh-6582
2016-12-16 13:59:50 +01:00
Stephane Nicoll
f560f338ab Polish contribution
Closes gh-7219
2016-12-16 11:58:26 +01:00
Vedran Pavic
60e054d0e4 Add LoggersEndpointMBean
See gh-7219
2016-12-16 11:05:17 +01:00
Eddú Meléndez
fc09a23991 Add missing actuator metadata
Health metadata for cassandra and couchbase is added.

See gh-7632
2016-12-14 19:16:42 +01:00
Johnny Lim
6d1b752ffe Polish
Closes gh-7552
2016-12-14 19:14:24 +01:00
Oscar Utbult
38713c473f Remove redundant array creation for calling varargs method
Closes gh-7551
2016-12-14 19:12:08 +01:00
Andy Wilkinson
595679bed4 Disable management security when testing Jolokia endpoint 2016-12-13 13:02:40 +00:00
Andy Wilkinson
391a760c3c Merge branch '1.4.x' into 1.5.x 2016-12-13 09:44:16 +00:00
Andy Wilkinson
4ec95b8308 Ensure that JolokiaMvcEndpoint destroys underlying controller
Closes gh-7606
2016-12-13 09:42:14 +00:00
Dave Syer
1baf3c63c4 Make the Spring Security part of CF autoconfig conditional
Otherwise you get a class not found exception at runtime in
CF when Spring Securtity is not on the classpath.
2016-12-12 15:05:48 +00:00
Dave Syer
cc8ecb6ff5 Clear VCAP_APPLICATION after tests
So that other CF tests do not fail.
2016-12-12 15:05:07 +00:00
Madhura Bhave
5d8e00cb56 Fix HealthMvcEndpointTests
See gh-7569
2016-12-06 13:18:10 -08:00
Madhura Bhave
1be5812cf0 Require ACTUATOR role rather than ADMIN
Update management security to require an `ACTUATOR` role rather than
`ADMIN` by default. This should reduce the risk of users accidentally
exposing actuator endpoints because they happen to use a role named
`ADMIN`.

Fixes gh-7569
2016-12-05 17:58:16 -08:00
Madhura Bhave
95be208f0f Use IgnoredRequestCustomizer to ignore paths
Update `SpringBootWebSecurityConfiguration` to ignore requests by
delegating to `IgnoredRequestCustomizer` beans. This allows a single
Spring Boot `WebSecurityConfigurer<WebSecurity>` bean to be used which
prevents potential exceptions caused by duplicate `@Order` values.

Fixes gh-7106
2016-12-05 17:57:18 -08:00
Madhura Bhave
d09aafacda Add a security interceptor for actuator endpoints
Update `AbstractEndpointHandlerMapping` to support a security
interceptor that can be used to enforce endpoint security.

Fixes gh-6889
2016-12-05 17:57:00 -08:00
Andy Wilkinson
967625db1e Replace field injection with constructor injection in config classes
Closes gh-7563
2016-12-05 10:48:01 +00:00
Andy Wilkinson
1464425d64 Remove use of @Component from classes that are not scanned
Closes gh-7549
2016-12-02 17:57:21 +00:00
Stephane Nicoll
ee72e788ed Rename spring-boot-junit-runners to spring-boot-test-support
Closes gh-7421
2016-12-01 16:25:47 +01:00
Stephane Nicoll
85de72c0d0 Merge branch '1.4.x' into 1.5.x 2016-12-01 15:26:06 +01:00
Stephane Nicoll
2a85a2557d Fix health indicator auto-configuration order
Previously, the health auto-configuration `AutoconfigureOrder` entry for
couchbase was referring to the standard couchbase auto-configuration that
is not responsible to configure the `CouchbaseOperations` bean. Yet, the
health indicator implementation was relying on the presence of such a
bean.

This commit fixes the `AutoconfigureOrder` entry so that it refers to
`CouchbaseDataAutoConfiguration` now.

Closes gh-7543
2016-12-01 15:25:51 +01:00
Andy Wilkinson
9c20ada927 Merge branch '1.4.x' into 1.5.x 2016-12-01 13:26:45 +00:00
Andy Wilkinson
356edc725c Handle request mappings with regular expressions in MetricsFilter
Closes gh-7503
2016-12-01 13:22:55 +00:00
Andy Wilkinson
2be554456e Introduce SearchStrategy.ANCESTORS as a replacement for .PARENTS
Closes gh-6763
2016-11-28 15:41:53 +00:00
Andy Wilkinson
dce1487424 Merge branch '1.4.x' into 1.5.x 2016-11-24 20:57:34 +00:00
Andy Wilkinson
e19c6245ef Consider endpoints.sensitive when endpoints.health.sensitive is not set
Closes gh-7476
2016-11-24 20:57:29 +00:00
Andy Wilkinson
f5dd90815b Polishing: fix some compiler warnings 2016-11-22 11:07:51 +00:00
Phillip Webb
1657120286 Move ModifiedClassPathRunner to its own module
Migrate `ModifiedClassPathRunner` from `spring-boot` test source to
its own module.

Fixes gh-7420
2016-11-18 17:27:54 -08:00
Phillip Webb
c2c5611f77 Polish 2016-11-18 15:58:56 -08:00
Madhura Bhave
3a3228fc70 Add CORS interceptor for Cloud Foundry actuators
This interceptor processes the response with CORS headers
and apepars before the Cloud Foundry security interceptor.

See gh-7108
2016-11-18 09:26:31 -08:00
Andy Wilkinson
1cd781b242 Make spring-boot-test compatible with Mockito 2.1 and 2.2
We use some internal Mockito classes and some  breaking API changes
have been made to them in Mockito 2. This commit introduces a utility
class, SpringBootMockUtil, to shield our code from these differences.
Mockito 1 is called directly and Mockito 2 is called via reflection.

To allow these changes to be tested, FilteredClassPathRunner has been
enhanced to also support overriding a dependency on the class path.
As a result it has been renamed to ModifiedClassPathRunner. The new
ClassPathOverrides annotation can be used to provide the Maven
coordinates of one or more dependencies that should be resolved and
added to the class path. Such additions are added to the start of
the class path so that they override any existing dependency that
contains the same classes.

Closes gh-6520
2016-11-18 16:39:44 +00:00
Andy Wilkinson
5527e3fdad Fix SpringApplicationHierarchyTests following latest Neo4j changes
See gh-7391
2016-11-18 11:54:05 +00:00
Johnny Lim
8038882d46 Polish
Closes gh-7403
2016-11-16 13:36:51 -08:00
Andy Wilkinson
387a406aad Merge branch '1.4.x' into 1.5.x 2016-11-16 09:13:17 +00:00
Phillip Webb
449b42ffa0 Polish LinksEnhancer to use endpoint name
See gh-7164
See gh-7132
2016-11-15 18:07:50 -08:00
Madhura Bhave
ada02232b9 Change LinksEnhancer to use endpoint name
Update `LinksEnhancer` to use NamedEndpoint names as rel names. If the
endpoint name is not available, fallback to endpoint path. Allow
multiple hrefs per rel if path is different.

Fixes gh-7132
Closes gh-7164
2016-11-15 18:03:26 -08:00
Madhura Bhave
0e3a3df6f4 Return log levels in /loggers endpoint payload
Update `LoggersEndpoint` to additionally return the log levels actually
supported by the system.

Fixes gh-7396
2016-11-15 14:32:02 -08:00
Phillip Webb
764f13453a Merge branch '1.4.x' into 1.5.x 2016-11-15 13:58:54 -08:00
Phillip Webb
bacf0878af Polish 2016-11-15 10:40:21 -08:00
Andy Wilkinson
24cc5d5644 Give javac's type inferencing a helping hand 2016-11-15 13:29:19 +00:00
Andy Wilkinson
22e456a177 Merge branch '1.4.x' into 1.5.x 2016-11-15 13:14:30 +00:00
Madhura Bhave
2697bf2ba1 Add Content-Type to allowed headers for CloudFoundry actuators
See gh-7108
2016-11-11 12:09:16 -08:00
Madhura Bhave
af61278213 Extend HealthMvcEndpoint for Cloud Foundry
The CloudFoundryHealthMvcEndpoint does not perform additional
security checks since security is handled by the interceptor.

See gh-7108
2016-11-09 11:04:51 -08:00
Madhura Bhave
a3bcb2778f Add message to response body for Cloud Foundry security error
See gh-7108
2016-11-09 10:54:56 -08:00
Spring Buildmaster
e712a9ba8c Next Development Version 2016-11-08 16:55:37 +00:00
Andy Wilkinson
2e76687d17 Merge branch '1.4.x' into 1.5.x 2016-11-08 13:50:41 +00:00
Andy Wilkinson
5f44598d8b Remove use of static import that Checkstyle prohibits 2016-11-08 13:50:15 +00:00
Andy Wilkinson
218d28f74c Merge branch '1.4.x' into 1.5.x 2016-11-08 13:22:58 +00:00
Andy Wilkinson
33dcd853fd Ensure that health endpoint remains insecure without Spring Security
The changes made in 6a2ac080 mean that getSecurity() on
ManagementServerProperties will no longer return null when Spring
Security is on the classpath. This had the unwanted side-effect of
causing the health endpoint to hide its details when Spring Security
was not on the classpath.

This commit reinstates the previous behaviour by only considering
the health endpoint to be secure if Spring Security is on the
classpath and management.security.enabled is true.

Closes gh-7345
2016-11-08 13:18:05 +00:00
Madhura Bhave
82f89b4ac1 Add custom headers to allowed CORS headers for CF actuators
Update CORS configuration to support Authorization and X-Cf-App-Instance.

See gh-7108
2016-11-07 15:37:09 -08:00
Stephane Nicoll
01e66ecbd5 Merge branch '1.4.x' into 1.5.x 2016-11-05 11:15:27 +01:00
Stephane Nicoll
2c71cb8efd Polish 2016-11-05 11:10:17 +01:00
Stephane Nicoll
4407194c00 Replace sample by integration test
Closes gh-3888
2016-11-05 11:09:36 +01:00
Phillip Webb
6c76353682 Default management.cloudfoundry.enabled to true
Update `CloudFoundryActuatorAutoConfiguration` so that it is enabled
when `management.cloudfoundry.enabled` is missing.

See gh-7108
2016-11-04 17:26:25 -07:00
Madhura Bhave
a77cfc3b0e Skip SSL validation when calling Cloud Foundry
Update CloudFoundrySecurityService so that SSL validation is not
required. We're unlikely to have configured public keys for the
REST endpoints we need to call. Since the endpoints are provided via
environment variables we can implicitly trust them.

See gh-7108
2016-11-04 17:26:25 -07:00
Madhura Bhave
862a06eb7a Add POST to allowed CORS methods for CF actuators
Update CORS configuration to support POST.

See gh-7108
2016-11-04 16:41:49 -07:00
Madhura Bhave
1005feb27d Update discovery endpoint to respect AccessLevel
Change `CloudFoundryDiscoveryMvcEndpoint` so that `AccessLevel` rights
are consulted so that only accessible links are returned.

See gh-7108
2016-11-04 16:41:49 -07:00
Madhura Bhave
340f1d5574 Add security for Cloud Foundry actuators
Add security to Cloud Foundry actuator endpoints. Security is enforced
by a `HanderInterceptor` on `CloudFoundryEndpointHandlerMapping`. Each
endpoint call expects an 'Authorization' header containing a bearer
token. The token signature is checked against the UAA public keys then
passed to the Cloud Controller to obtain an ultimate access level.

The client may either have 'RESTRICTED' or FULL' access, with the latter
only providing access to a limited set of endpoints.

See gh-7108
2016-11-04 16:41:48 -07:00
Phillip Webb
81c5753f4d Merge branch '1.4.x' into 1.5.x 2016-11-03 14:49:38 -07:00
Phillip Webb
6a2ac080ac Create our own SessionCreationPolicy enum
Update `ManagementServerProperties` so that `security.sessions` no
longer uses `SessionCreationPolicy` from Spring Security. We now
use our own enun which allows `management.security.*` properties to
be set without the risk of a `ClassNotFoundException`.

Fixes gh-3888
2016-11-03 14:36:49 -07:00
Andy Wilkinson
bdfceae24c Merge branch '1.4.x' into 1.5.x 2016-11-03 20:15:13 +00:00
Andy Wilkinson
97e5e32496 Make sure the MetricsFilter uses committed response's status
Previously, if an exception was thrown during request handling after
the response had been committed, i.e. after the status and headers
had been written, the metrics filter would assume that it was a 500
response. This was potentially inaccurate as the status had already
been sent to the client and before the exception was thrown and it
may have been something other than a 500.

This commit updates MetricsFilter so that it will use the
status from the response if the response has been committed even when
an exception is thrown.

Closes gh-7277
2016-11-03 20:08:31 +00:00
Andy Wilkinson
fe50b2019e Merge branch '1.4.x' into 1.5.x 2016-11-01 13:52:51 +00:00
Andy Wilkinson
b191974faa Reflect Java 7/8 differences in javadoc for metric repository auto-config
Closes gh-6985
2016-11-01 13:51:46 +00:00
Phillip Webb
5b66ffbb4b Merge branch '1.4.x' into 1.5.x 2016-10-31 23:09:36 -07:00
Phillip Webb
60355e0e11 Fix ResourceHttpRequestHandler delegate
Fix ResourceHttpRequestHandler to set the ServletContext following the
Spring Framework update for SPR-14851.
2016-10-31 15:04:43 -07:00
Johnny Lim
7bb63238ab Fix typo
Closes gh-7253
2016-10-31 11:37:52 +01:00
Stephane Nicoll
c4d8fb1c09 Merge branch '1.4.x' into 1.5.x 2016-10-30 10:59:02 +01:00
Stephane Nicoll
6d50e26b70 Polish contribution
Closes gh-7215
2016-10-30 10:57:58 +01:00
Madhura Bhave
9bde1e89cb Move some tests to AbstractEndpointHandlerMapping
See gh-7108
2016-10-24 10:38:53 -07:00
Phillip Webb
a448183681 Polish /loggers actuator endpoint
See gh-7086
2016-10-24 10:24:36 -07:00
Ben Hale
06cb4fcca5 Add /loggers actuator endpoint
Add `LoggersEndpoint` that can enables listing and configuration of log
levels. This actuator builds on top of the `LoggingSystem` abstraction
and implements support for Logback, Log4J2, and JUL.  The LoggingSystem
interface is modified to require each implementation to list the
configuration of all loggers as well as an individual logger by name.

The MVC endpoint exposes these behaviors at `GET /loggers` and
`GET /loggers/{name}` (much like the metrics actuator).

In addition `POST /loggers/{name}` allows users to modify the level for a given
logger. This modification is passed to the logging implementation, which
then decides, as an internal implementation detail, what the final outcome
of the modification is (e.g. changing all unconfigured children). Users
are then expected to request the listing of all loggers to see what has
changed internally to the logging system.

Closes gh-7086
2016-10-24 10:24:36 -07:00
Stephane Nicoll
aec85787d2 Merge branch '1.4.x' into 1.5.x 2016-10-24 10:08:06 +02:00
Johnny Lim
eb7c0e4dc8 Remove unused
Closes gh-6966
2016-10-24 10:07:10 +02:00
Phillip Webb
2ba978b4ad Polish 2016-10-21 10:23:13 -07:00
Madhura Bhave
ab81d993e6 Add CloudFoundryDiscoveryMvcEndpoint
Update Cloud Foundry support with a discovery endpoint that shows what
endpoints are available.

See gh-7108
2016-10-21 10:16:09 -07:00
Madhura Bhave
7afb161fcf Add CloudFoundry EndpointHandlerMapping
Add a CloudFoundryEndpointHandlerMapping that can expose actuator
endpoints for Cloud Foundry "appsmanager" to use.

See gh-7108
2016-10-21 10:06:34 -07:00
Andy Wilkinson
a416f496c0 Clean up deprecation and unused code warnings 2016-10-18 20:43:05 +01:00
Madhura Bhave
7352d8e303 Improve EndpointHandlerMapping subclassing support
Update EndpointHandlerMapping so that it can be subclasses easily.
Subclasses can override the `path` that is used to map the endpoint,
allowing different mapping strategies to be used.

See gh-7108
2016-10-12 13:32:39 -07:00
Madhura Bhave
0be8a30276 Add EndpointHandlerMapping.getEndpoints(Class)
Add an additional method to EndpointHandlerMapping which allows
endpoints of a specific type to be returned.

See gh-7108
2016-10-12 13:32:38 -07:00
Madhura Bhave
7f1ff968a1 Support NamedMvcEndpoints
Introduce a new NamedMvcEndpoint interface which can be used when an
MvcEndpoint also has a logical name. Existing MvcEndpoints have been
reworked to implement the NamedMvcEndpoint interface.

Fixes gh-7156
2016-10-12 13:32:38 -07:00
Madhura Bhave
0f5007d69d Drop superfluous disabled check
Remove EndpointWebMvcManagementContextConfiguration `disabled` logic
since the configuration should even be processed when the management
port is `-1`.

Closes gh-7154
2016-10-12 12:19:35 -07:00
Madhura Bhave
84d0e8acd8 Fix EndpointHandlerMappingTests path references
Fix the TestEndpoint constructor to use an ID parameter rather than
path.
2016-10-12 12:19:35 -07:00
Phillip Webb
d818a09ed8 Polish 2016-10-11 23:38:14 -07:00
Stephane Nicoll
cfee9bab81 Deprecate remote shell support
Closes gh-7044
2016-10-11 17:39:28 +02:00
Andy Wilkinson
9b6fa1e8d7 Separate conditions that did and did not match in auto-config endpoint
Closes gh-7122
2016-10-06 17:15:38 +01:00
Stephane Nicoll
cf28663cd7 Deprecate commons-dbcp 1
Closes gh-6787
2016-10-05 15:21:09 +02:00
Phillip Webb
f2b0fa284e Merge branch '1.4.x' into 1.5.x 2016-10-03 22:38:22 -07:00
Phillip Webb
3326841a97 Formatting 2016-10-03 22:19:35 -07:00
Phillip Webb
39ed0d4dfb Polish 2016-10-03 21:58:13 -07:00
Stephane Nicoll
3d9c56fbf3 Merge branch '1.4.x' into 1.5.x
# Conflicts:
#	spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java
#	spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java
2016-10-03 10:42:07 +02:00
Stephane Nicoll
8c1b736bb0 Fix list property to be mutable
Closes gh-7068
2016-10-03 10:40:46 +02:00
Vedran Pavic
c4aa78679a Upgrade Hazelcast to 3.7.1
In addition, dependency management for `hazelcast-hibernate5` module has
been added, and a separate dependency version was introduced for
`hazelcast-hibernate4` module.

Closes gh-7023
2016-09-29 10:37:29 +02:00
Andy Wilkinson
c108da9d53 Upgrade to Spring Data Ingalls M1
Closes gh-6785
Closes gh-5835
2016-09-21 17:01:47 +01:00
Stephane Nicoll
bd7c20eb1c Deprecate Guava support 2016-09-21 14:59:02 +02:00
Stephane Nicoll
ce1e41dce3 Remove deprecated code
This code removes code deprecated in 1.4 with the exception of code that
requires an update to Spring Framework 5.

Closes gh-6971
2016-09-21 14:30:28 +02:00
Stephane Nicoll
6bd670edbc Initiate 1.4.x branch 2016-09-21 11:11:24 +02:00
Spring Buildmaster
7e9ed5e1a7 Next Development Version 2016-09-21 07:58:07 +00:00
Spring Buildmaster
5f959b074f Next Development Version 2016-09-20 20:20:06 +00:00
Andy Wilkinson
155cfb1805 Fix boot curies href when server has custom servlet path
Previously, the servlet path was being applied twice. Once by the
code that sets up the DefaultCurieProvider and once by the provider
itself which uses ServletUriComponentBuilder's
fromCurrentServletMapping() to build the application URI.

This commit removes the duplicate logic when creating the
DefaultCurieProvider.

Closes gh-6585
2016-09-19 12:40:38 +01:00
Phillip Webb
825dd0a26c Merge branch '1.3.x' 2016-09-16 15:07:18 -07:00
Phillip Webb
3172d434a7 Polish
Closes gh-6835
2016-09-16 13:31:54 -07:00
Phillip Webb
c56f30fd91 Formatting 2016-09-12 12:44:31 -07:00
Stephane Nicoll
c662986628 Merge branch '1.3.x' 2016-09-12 16:30:25 +02:00
Stephane Nicoll
6eb0449aa9 Use BDD mockito
See gh-6869
2016-09-12 16:30:07 +02:00
Stephane Nicoll
d87d60f746 Merge branch '1.3.x' 2016-09-12 16:02:28 +02:00
Stephane Nicoll
b88cb35ea2 Fix JMS health indicator
This commit improves the JMS health indicator to identify a broken broker
that uses failover. An attempt to start the connection is a good way to
make sure that it is effectively available.

Closes gh-6818
2016-09-12 15:59:18 +02:00
Phillip Webb
3570f7730a Prevent erroneous "empty locations" log warnings
Update our `ResourceHttpRequestHandler` subclass so that the following
warning is no longer displayed:

  "Locations list is empty. No resources will be served unless a
  custom ResourceResolver is configured as an alternative to
  PathResourceResolver."

Fixes gh-6791
2016-09-09 13:19:58 -07:00
Vedran Pavic
d87bec11fb Include AuditEvent details in AuditListener
Update `AuthorizationAuditListener` to include `AuditEvent` data if
found.

Closes gh-6851
2016-09-09 12:48:30 -07:00
Phillip Webb
7396ccfe04 Harmonize ConditionOutcome messages
Add ConditionMessage class to help build condition messages in a
uniform format and update existing conditions to use it.

Fixes gh-6756
2016-09-07 10:50:39 -07:00
Phillip Webb
41dc53f5dd Polish 2016-09-07 08:34:45 -07:00
Johnny Lim
4b9f6869f0 Polish
Closes gh-6817
2016-09-05 09:08:08 +02:00
Stephane Nicoll
b7da0bd301 Merge branch '1.3.x' 2016-09-05 09:00:52 +02:00
Vedran Pavic
b88889f020 Polish HealthEndpoint javadoc
Closes gh-6815
2016-09-05 09:00:08 +02:00
Andy Wilkinson
3814e509a3 Polish @deprecated javadoc and link to replacements where available
Closes gh-6765
2016-08-31 14:34:49 +01:00
Andy Wilkinson
9874c22e23 Fix HAL browser endpoint redirect and entry point with custom servlet path
Previously, the HAL browser endpoint did not consider the dispatcher
servlet’s path (server.servlet-path) when redirecting to browser.html
or when updating the API entry point in the served HTML.

This commit moves to using ServletUriComponentsBuilder to build the URI
for the redirect and the path for the entry point. In the interests of
simplicity the logic that sometimes redirected and sometimes forwarded
the request has been changed so that it will always perform a redirect.

Closes gh-6586
2016-08-31 11:22:45 +01:00
Phillip Webb
565ad79856 Polish 2016-08-29 20:26:30 +01:00
Johnny Lim
524edaea51 Polish
Closes gh-6728
2016-08-23 15:13:33 +02:00
Andy Wilkinson
98d81110f2 Write management and main server access logs to separate files
Previously, when access logging was enabled and the management server
was running on a separate port, both the main server and the management
server would write their access logs to the same file. Having two
separate containers writing to the same file could cause problems such
as causing log rotation to break.

This commit updates the actuator so that when the management server is
running on a separate port (and therefore using a separate container)
it prepends management_ to the access log prefix so that the main
server and the management server write their access logs to separate
files in the same directory.

Closes gh-6618
2016-08-22 11:57:51 +01:00
Andy Wilkinson
13a9bc0537 Polish “Allow injection of StatsDClient into StatsdMetricWriter”
Closes gh-6588
2016-08-16 13:25:16 +01:00
Nick Pillitteri
63085fb441 Allow injection of StatsDClient into StatsdMetricWriter
Allow an instance of StatsDClient to be injected into the StatsdMetricWriter
which is used for exporting metrics to a Statsd server. This new constructor
allows the client to be injected but does not change the default behavior of
the writer.
2016-08-16 13:23:25 +01:00
Andy Wilkinson
df4ef3e1cb Merge branch '1.3.x' 2016-08-15 13:47:32 +01:00
Andy Wilkinson
ffc0dc44ed Make Flyway and Liquibase endpoints conditional on a single candidate
Previously, auto-configuration of the Flyway and Liquibase endpoints
would fail if there were multiple Flyway or Spring Liquibase beans
in the application context.

This commit updates them so that they are now conditional on a single
candidate.

Closes gh-6609
2016-08-15 13:43:03 +01:00
Stephane Nicoll
4882544c84 Polish contribution
Closes gh-6540
2016-08-13 08:02:04 +02:00
Eddú Meléndez
dced154f71 Fix health endpoint security
Commit b02aba4 has renamed `management.security.role` to
`management.security.roles`. Unfortunately, the `HealthMvcEndpoint`
was still looking at the old property.

This commit makes sure that the proper key is used and any custom
role is applied rather than an unconditional `ADMIN` role.

See gh-6540
2016-08-13 07:26:41 +02:00
Phillip Webb
a49f309ec1 Call afterProperties set in LogFileMvcEndpoint
Call afterPropertiesSet on the delegate `ResourceHttpRequestHandler`
to prevent an NPE. This change is required for compatibility with
Spring Framework 4.3 following SPR-13834.

Closes gh-6592
2016-08-11 16:11:29 +01:00
Andy Wilkinson
22ac6bcb2d Break GaugeWriter dependency cycle in MetricExportAutoConfiguration
Previously, MetricExportAutoConfiguration consumed
ExportMetricWriter-annotated GaugeWriter beans in its constructor and
also produced such a bean from one of its @Bean methods. This cycle
caused a BeanCurrentlyInCreationException to be thrown when the
bean method was active (the spring.metrics.export.statsd.host property
was set).

This commit break the cycle by moving the bean method into a separate,
nested configuration class. It also updates the existing test for
auto-configuration of a Statsd writer to catch any possible cycles
and to verify that the writer has be registered with the
MetricsExporter.

Closes gh-6544
2016-08-10 14:54:42 +01:00
Andy Wilkinson
19cddd650d Merge branch '1.3.x' 2016-08-08 17:25:15 +01:00
Andy Wilkinson
cec6015f8a Cope with null server or management port when creating curie provider
Previously, a NullPointerException would occur if
endpoints.docs.curies.enabled was true and the default value was being
used for either server.port or management.port.

EndpointWebMvcHypermediaManagementContextConfiguration has been
restructured to ensure that the DocsMvcEndpoint bean is defined before
the condition on its existence is evaluated. Previously this was
dependant on the class’s bean methods being processed in a particular
ordering, something that would be ok when using ASM but would vary when
using reflection.

Closes gh-6584
2016-08-08 17:16:00 +01:00
Spring Buildmaster
334baaeffd Next development version 2016-07-28 19:54:01 +00:00
Spring Buildmaster
a89ef5df6e Next Development Version 2016-07-28 09:18:40 +00:00
Phillip Webb
ac1ad2a145 Polish 2016-07-27 16:27:11 -07:00
Johnny Lim
9627d0ed66 Polish
Closes gh-6487
2016-07-27 12:29:33 +01:00
Chad
18dd125059 Unescape quotation marks in JavaDoc
Closes gh-6482
2016-07-26 21:42:22 -07:00
Phillip Webb
496b3a8d75 Relocate FileWriters to spring-boot
Move ApplicationPidFileWriter and EmbeddedServerPortFileWriter to the
core spring-boot project since they're not really tied to the actuator.

Fixes gh-6398
2016-07-25 13:45:29 -07:00
Johnny Lim
68fe8a58b8 Align message with regex for AbstractMvcEndpoint.path
Closes gh-6437
2016-07-21 17:04:32 +01:00
Andy Wilkinson
fe22609096 Test that temp file has been deleted before triggering heap dump
The MBean requires that a file does not exist at the location to which
it’s dumping the heap. This commit updates the test to ensure that the
temporary file that’s created to get a location for the heap dump file
is deleted before asking the MBean to dump the heap to that location.
2016-07-21 13:51:51 +01:00
Phillip Webb
05cde789e1 Reduce noise in /end actuator docs
Update the `/env` sample used in the actuator docs to use only a limited
set of keys.

Fixes gh-5849
2016-07-19 09:41:12 -07:00
Phillip Webb
05ff4ed4e0 Upgrade to Tomcat 8.5.4 & remove tomcat-juli
Upgrade the managed Tomcat dependency to 8.5.4 and remove `tomcat-juli`
since it's now included in `tomcat-embed-core`.

Fixes gh-6192
2016-07-18 17:52:35 -07:00
Phillip Webb
e03e109874 Polish 2016-07-18 11:27:55 -07:00
Stephane Nicoll
7e6f4021de Polish contribution
Closes gh-6059
2016-07-18 08:54:27 +02:00
RichardCSantana
42bb843364 Fix Bug HealthIndicator for Redis Cluster
See gh-6059
2016-07-18 08:48:01 +02:00
Andy Wilkinson
91df749839 Improve usage of ConcurrentMap
- Call get rather than containsKey then get
- Only call putIfAbsent after get has returned null to avoid unnecessary
  object creation

Closes gh-6382
2016-07-13 09:26:28 +01:00
Adrian Cole
38e3b39d3b Improves metrics performance by not guarding map.get
ConcurrentHashMap implements `containsKey` with `get`. By removing a
redundant call to `containsKey`, we guarantee better performance in our
counter services.

The geek inside measured this with JMH, and found under 4 threads of
contention, throughput on this check was 40% higher in success case.

Benchmark                                  Mode  Cnt     Score     Error   Units
TestBenchmarks.containsKeyAndGet_success  thrpt   30   432.389 ±  20.616  ops/us
TestBenchmarks.get_success                thrpt   30   606.789 ±  10.848  ops/us

Closes gh-6379
2016-07-13 08:56:13 +01:00
Johnny Lim
a9f6ae4422 Polish
Closes gh-6374
2016-07-12 08:46:58 +02:00
Andy Wilkinson
8e669e2eef Merge branch '1.3.x 2016-07-11 17:03:16 +01:00
Andy Wilkinson
4963cfd67b Reset thread's interrupted flag when catching InterruptedException
Closes gh-6360
2016-07-11 16:46:05 +01:00
Andy Wilkinson
e53d3167ab Set TCCL of shutdown thread when triggered by the shutdown endpoint
Previously, the shutdown endpoint would spawn a new thread to perform
the shutdown but did not explicitly configure its thread context
class loader (TCCL). This mean that the new thread would use the
request thread's TCCL as its TCCL. This meant that a different TCCL
would be used compared to a shutdown triggered by the shutdown hook
and also caused problems with Tomcat's thread leak detection logic.

This commit updates the shutdown endpoint to explicitly configure the
TCCL of the shutdown thread to be the ClassLoader that loaded the
endpoint's class.

Closes gh-6361
2016-07-11 11:27:41 +01:00
Andy Wilkinson
c974de0119 Merge branch '1.3.x 2016-07-11 11:27:15 +01:00
Andy Wilkinson
5f751fe356 Set TCCL of shutdown thread when triggered by the shutdown endpoint
Previously, the shutdown endpoint would spawn a new thread to perform
the shutdown but did not explicitly configure its thread context
class loader (TCCL). This mean that the new thread would use the
request thread's TCCL as its TCCL. This meant that a different TCCL
would be used compared to a shutdown triggered by the shutdown hook
and also caused problems with Tomcat's thread leak detection logic.

This commit updates the shutdown endpoint to explicitly configure the
TCCL of the shutdown thread to be the ClassLoader that loaded the
endpoint's class.

Closes gh-6361
2016-07-11 11:16:34 +01:00
Phillip Webb
bd65045285 Allow WebRequestTraceFilter header post processing
Update WebRequestTraceFilter so that additional post processing can be
applied to traced request headers. The postProcessRequestHeaders method
can be used to remove or change map entries before they are returned.

Fixes gh-6309
2016-07-06 17:45:35 -07:00
Andy Wilkinson
5bfc6a50fd Remove accidental usage of Type.getTypeName() which is a Java 8 API
Closes gh-6325
2016-07-05 15:21:50 +01:00
Spring Buildmaster
2216369348 Next Development Version 2016-07-04 14:15:02 +00:00
Lari Hotari
9f07e94450 Add MVC actuator endpoint for heap dumps
Add MVC only endpoint to obtain GZip compressed heap dump files.

See gh-5670
2016-07-02 11:14:42 -07:00
Lari Hotari
e1893f66ce Extract AbstractMvcEndpoint class
Extract common functionality from Spring MVC only endpoints.

See gh-5670
2016-07-02 11:13:21 -07:00
Phillip Webb
b732aeb453 Polish 2016-07-02 10:52:59 -07:00
Andy Wilkinson
5c6537c234 Consistently synchronize on this.monitor in InMemoryAuditEventRepository
See gh-6261
2016-07-01 14:09:07 +01:00
Andy Wilkinson
92bb24e365 Avoid synchronizing on this and use an internal monitor instead
Where possible, code that previously synchronized on this (or on the
class in the case of static methods) has been updated to use an
internal monitor object instead. This allows the locking model that's
employed to be an implementation detail rather than part of the
class's API.

Classes that override a synchronized method continue to declare
the overriding method as synchronized. This ensures that locking
is consistent across the superclass and its subclass.

Closes gh-6262
2016-07-01 10:44:23 +01:00
Phillip Webb
516df88ea0 Revisit AuditEventRepository interface
Update AuditEventRepository to restore support for `null` arguments and
explicitly Javadoc their meaning.

See gh-5854
2016-06-30 17:27:55 -07:00
Stephane Nicoll
3ba2b24301 Polish "Improve AuditEventRepository"
Closes gh-5854
2016-06-30 11:44:01 +02:00
Vedran Pavic
5f19323fbd Improve AuditEventRepository
See gh-5854
2016-06-30 11:20:23 +02:00
Phillip Webb
266445aaf0 Polish 2016-06-29 10:44:33 -07:00
Johnny Lim
5bc9d5b380 Polish
Closes gh-6244
2016-06-29 08:08:53 +02:00
Stephane Nicoll
84b2ff5c38 Polish "Add ability to filter cookies in trace data"
Closes gh-6018
2016-06-27 16:41:10 +02:00
Venil Noronha
fde5e1b6a5 Add ability to filter cookies in trace data
See gh-6018
2016-06-27 15:43:47 +02:00
Andy Wilkinson
618535f576 Polish “Allow management server SSL to be configured independently”
This commit polishes b0fbc7e, throwing an exception when an attempt is
made to configure management-specific SSL without also configuring a
custom management port. The testing of management-specific SSL
configuration has also been improved.

See gh-6057
Closes gh-4810
2016-06-27 13:24:42 +01:00
Alex Antonov
3546ae399e Allow management server SSL to be configured independently
Closes gh-6057
2016-06-27 13:24:42 +01:00
Phillip Webb
15670b8e28 Relocate Neo4J auto-configuration
Move Neo4J auto-configuration from `autoconfigure.neo4j` to
`autoconfigure.data.neo4j` since it's intrinsically linked to Spring
Data.

See gh-5458
See gh-6142
2016-06-24 12:49:11 -07:00
Stephane Nicoll
fda2505be6 Fix checkstyle violations 2016-06-23 11:14:28 +02:00
Stephane Nicoll
2dc6e5b6fa Refactor Jest auto-configuration package space
This commit moves the Jest auto-configuration from `spring.jest` to
`spring.elasticsearch.jest`

Closes gh-6032
2016-06-23 10:39:16 +02:00
Andy Wilkinson
e5827f4840 Merge branch '1.3.x' 2016-06-21 15:09:56 +01:00
Andy Wilkinson
6c8f8c9d82 Better diagnotics when ESCF subclass breaks with custom management port
When a custom management.port is used, the child context is configured
with an EmbeddedServletContainerFactory bean that has the same class
as the parent context’s EmbeddedServletContainerFactory bean. This
ensures that the child context uses the same type of embedded container
as its parent when there are multiple embedded containers on the
classpath. It also causes a failure when the custom
EmbeddedServletContainerFactory subclass cannot be instantiated, for
example because it’s an anonymous inner-class.

This commit improves the diagnostics so that we fail fast with an
information exception message when we detect that the embedded servlet
container factory bean’s class cannot be instantiated.

Closes gh-6193
2016-06-21 15:05:00 +01:00
Phillip Webb
7446235ff4 Polish 2016-06-20 20:13:13 -07:00
Phillip Webb
c136054e69 Merge branch '1.3.x' 2016-06-20 18:54:01 -07:00
Phillip Webb
5b97981c87 Polish 2016-06-20 18:13:43 -07:00
Andy Wilkinson
f28e3d54c5 Upgrade to Tomcat 8.5.3
This commit changes the default version of Tomcat to 8.5.3 while
also retaining support for Tomcat 8.0 and 7.0. The main difference
in 8.5 is that the ServerSocketFactory abstraction that allowed the
TrustStore and KeyStore to be configured programatically no longer
exists. This logic has been replaced with the use of a custom URL
protocol (springbootssl) that provides access to the key store and
trust store of an SslStoreProvider. In addition to working with 8.5,
this approach has the advantage of also working with 8.0 and 7.0.

Closes gh-6164
2016-06-20 13:27:47 +01:00
Stephane Nicoll
06b81cf16f Use @AliasFor when applicable
This commit adds `@AliasFor` meta-data to annotations that declare an
alias attribute.

`@ConditionalOnProperty` and `@AutoconfigureRestDocs` were not migrated
due to the use of `AnnotationMetadata#getAnnotationAttributes`.

Closes gh-5187
2016-06-20 14:20:16 +02:00
Andy Wilkinson
971913e672 Polish 2016-06-17 21:01:29 +01:00
Stephane Nicoll
3799496dc8 Merge branch '1.3.x' 2016-06-17 17:50:47 +02:00
Stephane Nicoll
9abca48a7f Fix HAL browser entry point with contextPath
Previously, if the `contextPath` of the application wasn't the root, the
HAL browser could not initialize since the `entryPoint` was referring to
an invalid location.

This commit makes sure to take the `contextPath` into account.

Closes gh-5814
2016-06-17 17:49:49 +02:00
Andy Wilkinson
fa0a137cd2 Merge branch '1.3.x' 2016-06-17 13:16:34 +01:00
Andy Wilkinson
a2446080bc Prevent GC pressure from causing an NPE in SimpleInMemoryRepository
Previously, SimpleInMemoryRepository used a ConcurrentReferenceHashMap
to store its locks. The type of map will discard its entries when the
JVM comes under GC pressure. With the code in its previous form, this
could lead to a NullPointerException when the following occurred:

1. putIfAbsent returned null indicating that a new entry has been added
   to the map
2. GC pressure caused the map to discard the new entry
3. get returned null as the entry has been discard

There are two problems with the existing code:

1. Its usage of a ConcurrentMap is incorrect. The correct usage is:
   a. Call get to see if the map already contains a lock
   b. If the lock is null, create a new one
   c. Call putIfAbsent to add the new lock
   d. If the return value is non-null, another thread has created the
      lock and it should be used. If the return value is null, use the
      new lock created in b.
2. Once the use of ConcurrentMap has been corrected, the fact that it is
   a ConcurrentReferenceHashMap means that different threads could
   access the same value using different locks. This would occur if one
   thread has retrieved a lock from the map and is using it, while GC
   causes the lock to be removed from the map. Another thread then
   attempts to get the lock and, as GC pressure has remove it, a new
   lock is created allowing concurrent access to the same value.

This commit updates the code to use the ConcurrentMap correctly and also
replaces the ConcurrentReferenceHashMap with a ConcurrentHashMap. This
means that the repository will now use slightly more memory but this is
outweighed by the benefits of thread-safe updates and no risk of an NPE.

Closes gh-6115
2016-06-17 13:13:49 +01:00
Stephane Nicoll
64bbefd3ac Add Jest-based health indicator
This commit adds a Jest-based health indicator for ElasticSearch. If both
Jest and the Spring Data are available, the latter takes precedence as it
provides more information.

Closes gh-3178
2016-06-13 17:19:04 +02:00
Phillip Webb
ee319a6d8b Merge branch '1.3.x' 2016-06-10 21:11:00 -07:00
Johannes Edmeier
e89063cc07 Close connection after use in LiquibaseEndpoint
Update LiquibaseEndpoint so that connections are closed and returned to
the pool after use.

Fixes gh-6118
2016-06-10 21:03:15 -07:00
Phillip Webb
99c6194e17 Don't use MockitoJUnitRunner
Replace `@RunWith(MockitoJUnitRunner.class)` with direct Mockito
initialization since the running doesn't support parallel test
execution.
2016-06-09 20:55:59 -07:00
Johnny Lim
8704e4869d Polish
Closes gh-6066
2016-06-07 08:40:47 -04:00
Phillip Webb
14c7a1284e Formatting 2016-05-25 14:30:13 -07:00
Stephane Nicoll
b02aba4c75 Polish contribution
Closes gh-5074
2016-05-23 17:38:45 +02:00
Vedran Pavic
20fa1b3b48 Support configuration of multiple management roles
Closes gh-5045
2016-05-23 17:15:44 +02:00
Stephane Nicoll
6698af08df Replace Starter POM to Starter in the documentation
"Starter POM" is a confusing term as it implies the starter may be a
POM while it's actually a jar artifact like any other dependency. To
reduce the confusion (especially in the way such starter should be
declared in the build), the term Starter POM has been renamed to Starter.

Closes gh-5966
2016-05-18 08:55:42 +02:00
Phillip Webb
68983400fb Propogate startup failures to management context
Update EndpointWebMvcAutoConfiguration so that ApplicationFailedEvents
cause the management context to close.

Prior to this commit if an application failed to start (for example
because `server.port` was already in use) the management context would
remain open and the application would not exit.

Fixes gh-5388
2016-05-16 17:26:03 -07:00
Ruben Dijkstra
c84e09f611 Fix incorrect usage of Assert.notNull()
Closes gh-5931
2016-05-13 09:16:23 +02:00
Phillip Webb
cf6212b955 Polish 2016-05-10 10:22:37 -07:00
Spring Buildmaster
819a9574a6 Next Development Version 2016-05-10 05:28:34 +00:00
Andy Wilkinson
3348ed5bb3 Make use of new GetMapping and PostMapping annotations
Closes gh-5277
2016-05-09 17:08:16 +01:00
Spring Buildmaster
376bbe68d8 Next Development Version 2016-05-06 11:23:57 +00:00
Dave Syer
0ec5b7f43b Fix some more tests 2016-05-06 12:00:33 +01:00
Dave Syer
95c78e4e4c Fix test 2016-05-06 11:36:24 +01:00
Dave Syer
323d6e54a9 Add backwards compatible constructor to InfoEndpoint
Anyone who is extending InfoEndpoint (per the docs) in 1.3 can
continue to compile their code until they have time to adapt
to the new model.
2016-05-06 11:35:43 +01:00
Stephane Nicoll
21536f64e1 Polish info contributor feature
This commit improves the `InfoContributor` infrastructure as follows:

* `InfoEndpoint` no longer breaks its public API and returns a Map as
before
* `Info` is now immutable
* All properties of the build are now displayed. Since we control the
generation of that file, there is no longer a mode to restrict what's
shown
* Build info is now generated in `META-INF/build-info.properties` by
default

Closes gh-5734
2016-05-06 10:52:26 +02:00
Vedran Pavic
0b70710bbc Allow customization of AuditListener
Introduce `AbstractAuditListener` so that users can extended it to
replace the auto-configured default.

Fixes gh-5830
2016-05-02 17:15:23 -07:00
Johnny Lim
0efa0038c3 Polish
Closes gh-5815
2016-04-30 10:24:33 +02:00
Phillip Webb
590bd5c084 Fixup warnings 2016-04-28 16:50:03 -07:00
Phillip Webb
609cb52cd4 Move to relocated web classes
Refactor code to move from recently deprecated classes.

Closes gh-5822
2016-04-28 12:45:15 -07:00
Phillip Webb
aea18671c1 Restructure web related classes
Reorganize web related classes for better separation of concerns.
Mainly this involves moving classes from `o.s.b.context.embedded`
that aren't directly tied to embedded servlet containers to
`o.s.b.web` and relocating everything from `o.s.b.context.web`.

See gh-5822
2016-04-28 12:45:15 -07:00
Phillip Webb
a7cb689f95 Move @LocalServerPort annotation
Move the @LocalServerPort to org.springframework.boot.context.embedded
since it's only really useful when working with embedded servlet
containers.

See gh-5822
2016-04-28 12:45:15 -07:00
Johannes Edmeier
49ef93602e Add external-file-property to LogFileMvcEndpoint
Add an additional property to LogFileMvcEndpoint to allow log files to
be read from an external location. This is helpful when a launch.script
is used to start the boot-application and the logfile is written by a
redirect of stdout/stderr.

Fixes gh-4255
Closes gh-4836
2016-04-26 18:23:31 -07:00
Stephane Nicoll
5f41e82a89 Merge branch '1.3.x' 2016-04-26 08:29:38 +02:00
Stephane Nicoll
247685e992 Add missing @Documented
Closes gh-5786
2016-04-26 08:29:20 +02:00
Venil Noronha
0d47abbac4 Extract ApplicationContextHeaderFilter
Extract ApplicationContextHeaderFilter to a top-level class from
EndpointWebMvcAutoConfiguration and make the header field public.

Fixes gh-5726
Closes gh-5784
2016-04-25 14:16:08 -07:00
Phillip Webb
93382648ab Formatting 2016-04-24 22:54:27 -07:00
Phillip Webb
79922360e1 Polish 2016-04-24 22:49:41 -07:00
Dave Syer
014883253a Merge remote-tracking branch 'origin/1.3.x' 2016-04-22 09:40:12 +01:00
Dave Syer
b9db4742ac Add metric flusher to export remaining metrics on shutdown
Before this change the app context closes and metrics that have not
yet been exported ccan be orphaned. The design of this feature is simple:
use Closeable where possible, so that it will be called automatically
by Spring on shutdown.

Fixes gh-5771
2016-04-22 09:33:18 +01:00
Dave Syer
de2c22efee Merge remote-tracking branch 'origin/1.3.x' 2016-04-21 14:09:59 +01:00
Dave Syer
de0f0ecce4 Align counter behaviour between metric exporters
The MetricCopyExporter has had the capability for a while to keep
track of counters internally. This change aligns that with the
PrefixMetricGroupExporter.

Fixes gh-5762
2016-04-21 14:02:29 +01:00
Andy Wilkinson
58dac43b8d Update TraceWebFilterAutoConfiguration to use constructor injection 2016-04-19 16:25:49 +01:00
Andy Wilkinson
13c01376b0 Merge branch '1.3.x' 2016-04-18 17:08:27 +01:00
Andy Wilkinson
9210029109 Record trace with response status of 500 following unhandled exception
Previously, if the filter chain threw an unhandled exception,
WebRequestTraceFilter would record a trace with a response status of
200. This occurred because response.getStatus() would return 200 as
the container had not yet caught the exception and mapped it to an
error response.

This commit updates WebRequestTraceFilter to align its behaviour with
MetricsFilter. It now assumes that the response status will be a 500
and only updates that to the status of the response if the call to the
filter chain returns successfully.

To avoid making a breaking change to the signature of the protected
enhanceTrace method, an HttpServletResponseWrapper is used to include
the correct status in the trace.

Closes gh-5331
2016-04-18 16:56:54 +01:00
Andy Wilkinson
a2489b01aa Merge branch '1.3.x' 2016-04-18 15:30:30 +01:00
Andy Wilkinson
2e54078083 Tolerate possible null Flyway MigrationVersion when using Flyway 4.0
Flyway 4.0 provides support for repeatable migrations that do not
have a version. When such a migration has been performed,
MigrationInfo.getMigrationVersion() will return null and, previously,
FlywayEndpoint would fail with an NPE.

This commit updates FlywayEndpoint to use null as the version when
MigrationInfo.getMigrationVersion() returns null.

Closes gh-5700
2016-04-18 15:30:23 +01:00
Phillip Webb
5881c9c74f Polish 2016-04-15 22:39:35 -07:00
Stephane Nicoll
cc0fc07c0e Move shell.* to management.shell.*
This commit moves the `shell` namespace to `management.shell`

Closes gh-5703
2016-04-15 18:12:35 +02:00
Stephane Nicoll
6d11d73cbc Move shell.auth to shell.auth.type
This commit moves the `shell.auth` property to `shell.auth.type`. The
previous situation was unfortunate since `shell.auth` was both a group
and a particular property.

Closes gh-5139
2016-04-15 18:12:35 +02:00
Stephane Nicoll
f364d713dd Add LocalManagementPort
Add an annotation alias for the actual management port, similar to what
was done for the main context (`LocalServerPort`).

See gh-5548
2016-04-15 14:02:38 +02:00
Johnny Lim
030096c490 Polish
Closes gh-5661
2016-04-12 07:41:09 +02:00
Phillip Webb
7956e68224 Fix warnings 2016-04-11 11:41:38 -07:00
Johnny Lim
a0c8d1f5b5 Polish 2016-04-10 22:18:28 -07:00
Phillip Webb
ae249f7568 Merge branch '1.3.x' 2016-04-09 23:53:26 -07:00
Phillip Webb
a1284bce61 Configure ChildManagementContext container type
Ensure any ChildManagementContext created to start a management server
on a different port uses the same EmbeddedServletContainerFactory type.

Fixes gh-5474
2016-04-09 23:32:39 -07:00
Phillip Webb
3ca365cff0 Export MessageChannel metric writer
Update the auto-configured MessageChannelMetricWriter with
@ExportMetricWriter so that metrics are actually exported.

Fixes gh-5517
2016-04-09 23:32:38 -07:00
Phillip Webb
6550bb4cf1 Polish 2016-04-07 12:20:10 -07:00
Johnny Lim
3b5ecbd066 Polish
Closes gh-5627
2016-04-07 14:47:18 +01:00
Phillip Webb
01c9d72644 Polish 2016-04-06 15:19:58 -07:00
sebastiankirsch
a15684e67e Allow per-http-method MetricsFilter submissions
Add `endpoints.metrics.filter.gauge-submissions` and
`endpoints.metrics.filter.counter-submissions` properties which can be
used to fine-tune how MetricsFilter submits metrics.

Use `per-http-method` to group by the the HTTP method, `merged` to
combine or both (`merged,per-http-method`) to submit both in forms.

Closes gh-5102
2016-04-05 22:41:45 -07:00
Stephane Nicoll
05ef0818f8 Polish contribution
Closes gh-5511
2016-04-05 12:38:04 +02:00
Huang YunKun
6a2ff3f02a Upgrade elasticsearch to 2.2.0
Closes gh-5443
2016-04-05 12:38:04 +02:00
Phillip Webb
b398b3319c Rename @SpringApplicationTest -> @SpringBootTest
Rename @SpringApplicationTest to SpringBootTest and
@SpringApplicationContextLoader to @SpringBootContextLoader.

Fixes gh-5562
2016-04-04 22:36:58 -07:00
Phillip Webb
4d404b214c Migrate away from @SpringApplicationConfiguration
Refactor internal tests to no longer use @SpringApplicationConfiguration

See gh-5562
2016-04-04 22:36:57 -07:00
Andy Wilkinson
33f0ea3480 Rework SpringApplicationTest to support web modes
Rework the new testing support so that @SpringApplicationTest can be
used for standard integration tests, web integration tests with a
mock Servlet environment and web integration tests with an embedded
servlet container. This means that it a replacement for 1.3's
@IntegrationTest and @WebIntegrationTest and allows all
SpringApplication testing to be configured using a common annotation.

The old @IntegrationTest and @WebIntegrationTest along with their
supporting classes have been reinstated to their previous form (while
remaining deprecated). This should ensure that they continue to work
in 1.4 exactly as they did in 1.3 giving users a smooth path to
@SpringApplicationTest.

See gh-5477
2016-03-31 21:35:10 -07:00
Phillip Webb
8a11620052 Fix failing test due to SPR-14093 2016-03-29 20:56:56 -07:00
Stephane Nicoll
928f2dfc91 Sanitize keys with 'token' by default
This commit updates `Sanitizer` to sanitize by default a key containing
`token`.

Closes gh-5462
2016-03-29 13:28:13 +02:00
Phillip Webb
a3bfc29e6e Fix warnings 2016-03-25 12:46:53 -07:00
Stephane Nicoll
fd437797b6 Polish contribution
This commit polihes the original Neo4j contribution in several areas.

Rather than providing the packages to scan, this commit rearranges the
`EntityScan` and `EntityScanRegistrar` so that the logic can be shared
for other components. If no package is provided, scanning now defaults to
the "auto-configured" package(s) and a `@NodeEntityScan` annotation
allows to override that.

The configuration has also been updated to detect the driver based on the
`uri` property. If the embedded driver is available we use that by
default. If it is not available, we're trying to connect to a Neo4j
server running on localhost. It is possible to disable the embedded mode
or set the `uri` parameter explicitly to deviate from these defaults.

The sample no longer relies on the embedded driver for licensing reason:
rather it expects an instance running on localhost (like other
data-related samples) and gracefully ignore any connection error. A
README has been added in the sample to further explain the available
options;

Closes gh-5458
2016-03-25 11:39:49 +01:00
Michael Hunger
0658cc8aee Add Neo4j support
See gh-5458
2016-03-25 11:26:57 +01:00
Phillip Webb
c28f552883 Migrate SpringJUnit4ClassRunner to SpringRunner
Replace all existing SpringJUnit4ClassRunner references with the new
SpringRunner alias.

Fixes gh-5292
2016-03-23 22:18:18 -07:00
Phillip Webb
2f815a907a Migrate existing tests from deprecated package
Update the existing tests to use the relocated `spring-boot-test`
classes. Restructuring was achieved using the following command:

find . -type f -name '*.java' -exec sed -i '' \
-e s/org.springframework.boot.test.ConfigFileApplicationContextInitializer/\
org.springframework.boot.test.context.ConfigFileApplicationContextInitializer/g \
-e s/org.springframework.boot.test.EnvironmentTestUtils/\
org.springframework.boot.test.util.EnvironmentTestUtils/g \
-e s/org.springframework.boot.test.IntegrationTest/\
org.springframework.boot.test.context.IntegrationTest/g \
-e s/org.springframework.boot.test.IntegrationTestPropertiesListener/\
org.springframework.boot.test.context.IntegrationTestPropertiesListener/g \
-e s/org.springframework.boot.test.OutputCapture/\
org.springframework.boot.test.rule.OutputCapture/g \
-e s/org.springframework.boot.test.SpringApplicationConfiguration/\
org.springframework.boot.test.context.SpringApplicationConfiguration/g \
-e s/org.springframework.boot.test.SpringApplicationContextLoader/\
org.springframework.boot.test.context.SpringApplicationContextLoader/g \
-e s/org.springframework.boot.test.SpringBootMockServletContext/\
org.springframework.boot.test.mock.web.SpringBootMockServletContext/g \
-e s/org.springframework.boot.test.TestRestTemplate/\
org.springframework.boot.test.web.client.TestRestTemplate/g \
-e s/org.springframework.boot.test.WebIntegrationTest/\
org.springframework.boot.test.context.web.WebIntegrationTest/g {} \;

See gh-5293
2016-03-23 22:17:50 -07:00
Phillip Webb
aef7f4bcb1 Restructure spring-boot-test packages
Create a new package structure for `spring-boot-test` and deprecate
existing classes.

Fixes gh-5293
2016-03-23 22:17:27 -07:00
Phillip Webb
4352707eb3 Call afterProperties set in LogFileMvcEndpoint
Call afterPropertiesSet on the delegate `ResourceHttpRequestHandler`
to prevent an NPE. This change is required following SPR-13834.
2016-03-23 21:52:09 -07:00
Andy Wilkinson
19d8c5e6f6 Complete the move to constructor injection in configuration classes
This is a follow-on from the work done in 5009933. Now that SPR-14015
has been fixed, constructor injection can also be used for parameterised
dependencies, including optional dependencies that are injected via
an ObjectProvider.

Closes gh-5306
2016-03-23 14:43:04 +00:00
Phillip Webb
7942d9f787 Polish 2016-03-21 22:52:25 -07:00
Stephane Nicoll
2ae1435916 Polish 2016-03-21 15:43:27 +01:00
Stephane Nicoll
24f09e28c4 Prevent Redis to be initiated
This commit excludes the Redis auto-configuration that would attempt
to connect to a redis instance running at localhost otherwise.
2016-03-21 15:37:14 +01:00
Stephane Nicoll
f699bd2435 Fix build
`@ManagedResource` annotated bean must be public.
2016-03-17 11:50:48 +01:00
Stephane Nicoll
2526a54e31 Polish contribution
Closes gh-5337
2016-03-14 14:24:24 +01:00
Anand Shah
f6a32a1d5a Add @LocalServerPort
Closes gh-5262
2016-03-14 14:24:24 +01:00
Stephane Nicoll
dddea70985 Collect and display build information
This commit updates the Maven plugin to generate a
`META-INF/boot/build.properties` file with various build-specific
settings (group, artifact, name, version and build time). Additionally,
the plugin can be configured to write an arbitrary number of additional
properties.

A new `BuildProperties` bean is automatically exposed when such a file is
present. If that bean is present, an `InfoContributor` is automatically
created to expose that information under the `build` key.

As for the git contributor, it is possible to only display the core
settings or everything using the `management.info.build.mode` property.

See gh-2559
2016-03-10 17:21:31 +01:00
Stephane Nicoll
3e6b584953 Add Date as a support property type
Rather than exposing a raw String with the epoch time, GitProperties
now exposes the actual `java.util.Date`. `InfoProperties` has been
improved to return such data type when the raw value is an epoch time.
2016-03-10 14:42:48 +01:00
Stephane Nicoll
b906b18655 Initiate GitProperties
This commit polish the new info contributor infrastructure by migrating
`GitInfo` to `GitProperties`. `InfoProperties` provides an abstraction
that exposes unstructured data in an immutable way.

The `GitInfoContributor` now accepts a "mode" that determines if all data
should be exposed or only a sub-set of known keys.

Closes gh-2644
2016-03-09 16:37:44 +01:00
Phillip Webb
a3f3de223f Polish 2016-03-08 11:20:41 -08:00
Johnny Lim
122270c990 Polish
Closes gh-5345
2016-03-06 09:21:00 +01:00
Stephane Nicoll
830c4c996f Update computation of ehcache statistics
Previously, the ehcache statistics were computed on the activity of the
last minute which gives a "live" overview. All others cache managers,
including JCache, provides a "cumulative" metrics (i.e. the hit/miss
ratio since the creation of the cache or the last time it got cleared).

Ths commit aligns the ehcache statistics to provide a similar semantics
as the other cache managers. The side effect is that the metrics are now
available, even if there is no cache activity at all at the moment.

Closes gh-4891
2016-03-05 09:21:11 +01:00
Andy Wilkinson
5009933788 Move to constructor injection in simple configuration classes
This commit updates "simple" configuration classes to use constructor
injection. Simple means that there are no optional dependencies
(@Autowired(required=false) is not used), and none of the dependencies
use generics.

Configuration classes that are not simple will be updated in a second
pass once https://jira.spring.io/browse/SPR-14015 has been fixed.

See gh-5306
2016-03-04 12:27:29 +00:00
Stephane Nicoll
aba9389b25 Polish contribution
Closes gh-5328
2016-03-04 09:07:22 +01:00
Anand Shah
395c36a132 Rename HealthIndicatorAutoConfigurationProperties
Closes gh-5326
2016-03-04 09:02:56 +01:00
Phillip Webb
73cbb2f40a Polish 2016-03-03 09:14:24 -08:00
Stephane Nicoll
0490fbc7f8 Polish contribution
`InfoProvider` is now `InfoContributor` and contributes to the `Info`
instance via a builder. The `Info` instance is immutable. Each
contributor can be disabled via the `management.info.<name>.enabled`
key or all can be disabled using `management.info.defaults.enabled` (this
is similar to what the health endpoint does).

By default, all keys from the environment starting with `info.` are
exposed. If a `git.properties` file is present in the classpath, the
content of `GitInfo` is exposed using the `git` key.

A `SimpleInfoContributor` and `AbstractEnvironmentInfoContributor` are
available for convenience. `InfoContributor` instances can be ordered
the usual way, with a default order provided by
`InfoProviderAutoConfiguration#DEFAULT_ORDER`.

Closes gh-3492
2016-03-03 16:23:37 +01:00
Stephane Nicoll
7618802838 rebase to master 2016-03-03 14:40:21 +01:00
Meang Akira Tanaka
8bebe6dea9 Info endpoint
See gh-3492
2016-03-03 14:39:55 +01:00
Stephane Nicoll
0f820afa86 Auto-configure GitInfo
This commit moves `GitInfo` to a general "project info" area that will be
further improved with others project related information.

Deprecate `spring.git.properties` in favour of `spring.info.git.location`

Closes gh-2484
2016-03-03 14:31:00 +01:00
Stephane Nicoll
7029ba521d Remove management.dump_requests property
Closes gh-4283
2016-03-02 17:44:25 +01:00
Andy Wilkinson
ef5087c5ee Upgrade to Jackson 2.7.2
Closes gh-5081
2016-03-02 07:25:55 +00:00
Andy Wilkinson
355860fd09 Remove @Autowired from constructors where class has single constructor
Closes gh-5226
2016-03-01 16:03:07 +00:00
Stephane Nicoll
6741f05af1 Polish contribution
Closes gh-4903
2016-02-29 14:07:01 +01:00
Eddú Meléndez
98cc68364a Add Caffeine cache support
See gh-4899
2016-02-29 14:07:01 +01:00
Spring Buildmaster
225d877ab9 Next Development Version 2016-02-26 01:06:16 -08:00
Andy Wilkinson
ccf7de904c Upgrade to Infinispan 8.1.2.Final
Closes gh-5245
2016-02-25 20:55:47 +00:00
Andy Wilkinson
fcb5f03146 Upgrade to Hazelcast 3.6
Closes gh-5237
2016-02-25 20:15:02 +00:00
Andy Wilkinson
56487d23d6 Merge branch '1.3.x' 2016-02-25 20:00:34 +00:00
Vedran Pavic
6801e8208d Fix namespace declarations in Hazelcast xml's and make them consistent 2016-02-25 19:59:28 +00:00
Andy Wilkinson
44ddfcc7fa Upgrade copyright headers of all files changed in 2016 2016-02-25 12:09:42 +00:00
Andy Wilkinson
d3fc0a4733 Placate javac and its inferior type inferencing
The Eclipse compiler is perfectly happy with the original code, but
javac is not. This commit adds some explicit typing to keep javac
happy.
2016-02-24 13:24:36 +00:00
Andy Wilkinson
ef44d660bb Merge branch '1.3.x' 2016-02-24 12:55:03 +00:00
Andy Wilkinson
ce71bd997c Remove redundant public modifier 2016-02-24 12:51:33 +00:00
Andy Wilkinson
8f1f12be6a Fix Checkstyle warning introduced in forward merge (852ba546) 2016-02-24 12:37:06 +00:00
Andy Wilkinson
bee651fc17 Merge branch '1.3.x' 2016-02-24 12:37:00 +00:00
Andy Wilkinson
13971692dc Docs and actuator endpoints can be enabled when endpoints.enabled=false
Previously, if endpoints.enabled was false setting
endpoints.docs.enabled=true or endpoints.actuator.enabled=true would
have no effect as their entire configuration class was conditional
on endpoints.enabled being true.

This commit updates the conditions on the configuration class so that
it is conditional on either the actuator or docs endpoint being enabled.

Closes gh-5007
2016-02-24 12:32:09 +00:00
Andy Wilkinson
852ba54613 Merge branch '1.3.x' 2016-02-24 12:09:07 +00:00
Matt Benson
2a9e6c40ed Fix logic for disabling plugins in CrshAutoConfiguration
Plugin disabling logic was broken by e009d3e4. Prior to this change,
a plugin would be disabled if it or any of the implemented interfaces
in its inheritance hierarchy were configured as being disabled. The
offending commit inverted the logic so that the plugin would be
enabled if any part of it was NOT configured as being disabled.

This commit restores the logic such that the early return happens only
in the negative case.

Previously, the tests were written as though
PluginContext#getPlugin(Class) would consider the specified class
against the runtime type of the plugin (not an unreasonable
assumption); rather this method considers the broader 'plugin type'.
This commit rewrites the test to seek by plugin type and assert the
absence of the disabled plugins.

Closes gh-5032
2016-02-24 11:56:15 +00:00
Andy Wilkinson
a3afc859bd Merge branch '1.3.x' 2016-02-23 17:45:28 +00:00
Andy Wilkinson
617c97322d Allow endpoint paths to be configured via endpoint.<name>.path
Support for configuring an endpoint’s path separately from its id was
introduced in 97255785, but it didn’t work for a variety of reasons:

 1. Some custom MVC endpoints did not have configuration properties
    bound to them
 2. Some generic endpoints rejected the path property as they were
    configured not to ignore unknown fields
 3. The property used to configure the path was dependent on the id
    of the endpoint. This meant that the path property’s name would
    change if the endpoint’s id was changed

This commit addresses these problems:

 1. @ConfigurationProperties has been added to custom MvcEndpoints where
    it was missing
 2. Generic endpoints have been updated to ignore unknown fields,
    allowing the path of their MVC adapter to be configured
 3. Rather than using the id of a generic endpoint to determine the name
    of its path property, the prefix or value of the endpoint’s
    @ConfigurationProperties annotation is used instead. Any generic
    endpoint that is not annotated with @ConfigurationProperties is
    ignored, making its path unconfigurable.

Closes gh-5105
2016-02-23 17:06:51 +00:00