Commit Graph

1792 Commits

Author SHA1 Message Date
Phillip Webb 497457c397 Rename ApplicationContextTester -> Runner
Rename `ApplicationContextTester` and related classes to
`ApplicationContextRunner` and refactor existing tests to use correctly
named variables.

See gh-9875
2017-07-26 17:46:06 -07:00
Spring Buildmaster 41c5c0e7c9 Next development version 2017-07-26 08:30:55 +00:00
Emanuel Campolo 2626a3a795 Use lambdas when possible
Replace anonymous inner classes with lambda declarations (when possible
using method references).

See gh-9781
2017-07-25 00:53:38 -07:00
Emanuel Campolo 798fe5ed53 Collapse catch clauses
Use multi-catch for exceptions whenever possible.

See gh-9781
2017-07-25 00:53:37 -07:00
Emanuel Campolo 4a189bdee7 Replace Collections.sort() with direct sort call
Replace existing `Collections.sort(...)` calls with `.sort(...)`
directly on the collection instance.

See gh-9781
2017-07-25 00:53:37 -07:00
Emanuel Campolo 04fdec6f8b Replace explicit generics with diamond operator
Where possible, explicit generic declarations to use the Java 8 diamond
operator.

See gh-9781
2017-07-25 00:53:37 -07:00
Andy Wilkinson 6df1be3f1a Merge branch '1.5.x' 2017-07-22 08:22:35 +01:00
Johnny Lim d18e452fcd Use currentHealth consistently in getHealth()
Closes gh-9832
2017-07-22 08:21:43 +01:00
Andy Wilkinson d9837d7d1c Merge branch '1.5.x' 2017-07-21 17:31:53 +01:00
Andy Wilkinson bbc34a676c Polish "Handle possible regexes defensively in NamePatternFilter"
Closes gh-9730
2017-07-21 17:24:01 +01:00
dbego c29d1c756a Handle possible regexes defensively in NamePatternFilter
Previously, if a name contained part of a regex but wasn't actually
a regex, a PatternSyntaxException would be thrown and the request
would fail.

This commit updates NamePatternFilter to catch PatternSyntaxException
and treat the regex-like input as a name insteead.

See gh-9730
2017-07-21 17:21:49 +01:00
Phillip Webb e1ef2a591f Fixup tests to use new ApplicationContextTester
Update existing tests that previously use `ContextLoader` to the newly
introduced `*ApplicationContextTester` classes.

See gh-9634
2017-07-19 12:40:53 -07:00
Phillip Webb 9db72450da Merge branch '1.5.x' 2017-07-19 10:23:23 -07:00
Phillip Webb 68910f2b8f Polish 2017-07-19 10:21:06 -07:00
Phillip Webb cd23de6ed5 Add more HealthIndicatorAutoConfiguration ordering
Update HealthIndicatorAutoConfiguration to ensure that it is configured
after ActiveMQAutoConfiguration.

Fixes gh-9793
2017-07-19 10:19:42 -07:00
Stephane Nicoll 43e1df7752 Merge branch '1.5.x' 2017-07-19 15:45:14 +02:00
孙健 1745a5ee6f Fix metric check in case of duplicate metric
Closes gh-9497
2017-07-19 15:43:28 +02:00
Madhura Bhave b58923a42d Merge branch '1.5.x' 2017-07-17 11:27:08 -07:00
Madhura Bhave 0f8a819af9 Enable cors in default management security config
Fixes gh-9548
2017-07-17 10:49:48 -07:00
Phillip Webb 8e3baf3130 Polish 2017-07-11 13:57:21 -07:00
Stephane Nicoll cb13c98649 Polish 2017-07-08 15:36:18 +02:00
Stephane Nicoll fa71051ec6 Polish "Upgrade to Infinispan 9.0.3.Final"
Closes gh-9688
2017-07-08 15:30:13 +02:00
Stephane Nicoll ef5c2afcc9 Polish 2017-07-07 11:11:16 +01:00
Andy Wilkinson dd0ce54425 Improve the type-safety of ContextLoader for servlet and reactive web 2017-07-07 11:11:16 +01:00
Phillip Webb eb17aa06f9 Merge branch '1.5.x' 2017-07-06 18:38:52 -07:00
Phillip Webb aa57ca7e18 Polish 2017-07-06 16:53:04 -07:00
Andy Wilkinson 6db4330328 Prevent Elasticsearch from configuring Netty's available processors 2017-07-01 10:28:11 +01:00
Stephane Nicoll de2cdd8528 Use lettuce rather than Jedis for actuator tests 2017-06-30 15:44:15 +02:00
Stephane Nicoll 6e32f49630 Migrate HealthIndicatorAutoConfigurationTests to ContextLoader 2017-06-30 14:52:56 +02:00
Stephane Nicoll f2fe2c4dd5 Polish 2017-06-30 14:08:55 +02:00
Stephane Nicoll 8ea38d1cbe Merge branch '1.5.x' 2017-06-26 13:37:18 +02:00
Stephane Nicoll 88d16ddf6b Add missing class check
Closes gh-9602
2017-06-26 13:36:34 +02:00
Stephane Nicoll 01272fa0cc Polish "Add health indicator for Neo4j"
Closes gh-9557
2017-06-26 11:04:34 +02:00
Eric Spiegelberg 4c97dcb53a Add health indicator for Neo4j
See gh-9557
2017-06-26 10:31:02 +02:00
Andy Wilkinson 39c1757a96 Merge branch '1.5.x' 2017-06-21 14:31:21 -07:00
Andy Wilkinson 7a04708c41 Make sure the HealthMvcEndpoint is thread-safe
Previously, HealthMvcEndpoint stored the cached Health and its last
access time in two separate fields. Neither field was volatile and
no synchronization was used. This meant that there were potential
visibility problems. In a possible worst case scenario one field may
see the updated access time but an old health so it would incorrectly
believe that the old health was up-to-date and return it.

This commit reworks the endpoint to store the cached health and the
time at which it was created in a single, volatile field. This ensures
that the cached health and its creation time will be visible across
threads. Note that a race between threads when the cache is stale is
still possible. This race may result in multiple calls to the
delegate but these should be harmless.

Closes gh-9454
2017-06-21 14:19:10 -07:00
Stephane Nicoll 75274d3024 Merge branch '1.5.x' 2017-06-20 14:48:04 +02:00
Stephane Nicoll 3f70638f1c Polish "Use getUsableSpace() in DiskSpaceHealthIndicator"
Closes gh-9544
2017-06-20 14:44:11 +02:00
Huang YunKun 158416fdd0 Use getUsableSpace() in DiskSpaceHealthIndicator
See gh-9544
2017-06-20 14:43:38 +02:00
Andy Wilkinson 4a030d5a7a Drop support for auto-configuring an embedded Elasticsearch node
Elastic have announced [1] that embedded Elasticsearch is no longer
supported. This commit brings us into line with that announcement by
removing the auto-configuration that would create an Elasticsearch
Node and NodeClient.

To use the Elasticsearch auto-configuration, a user must now provide
the address of one or more cluster nodes
(via the spring.elastisearch.cluster-nodes property) which will then
be used to create a TransportClient.

See gh-9374

[1] https://www.elastic.co/blog/elasticsearch-the-server
2017-06-15 19:52:24 +01:00
Phillip Webb b94bb00fa1 Remove need for attached test-jar artifacts
Remove test-jar artifacts from Maven projects and relocate classes. The
majority of utilities now live in the `spring-boot-testsupport` module.

This update will help us to deploy artifacts using the standard Maven
deploy plugin in the future (which doesn't support the filtering of
individual artifacts).

Fixes gh-9493
2017-06-12 21:11:35 -07:00
Andy Wilkinson f7e9ec5f42 Minimise our usage of SocketUtils.findAvailableTcpPort
Closes gh-9382
2017-06-09 14:45:09 +01:00
Spring Buildmaster 05d4d0281c Next Development Version 2017-06-08 12:47:16 +00:00
Andy Wilkinson a72c1b2cba Merge branch '1.5.x' 2017-06-07 14:02:46 +01:00
Andy Wilkinson 9579e95868 Handle explicit disablement of management SSL correctly
Closes gh-9423
2017-06-07 13:57:59 +01:00
Phillip Webb 2c7dd9f519 Polish 2017-06-02 16:00:39 -07:00
Phillip Webb b9fd99e268 Polish 2017-06-02 13:47:28 -07:00
Stephane Nicoll 605dee4700 Allow to reset a log level
This commit ensures that `setLogLevel` on the `LoggingSystem` accepts
a `null` level. A `null` level means any customization sets on that
level should be removed and the default configuration should be used
instead.

Effectively, the level of the parent logger is going to be used when
`setLevel` is called with `null` for a given logger.

Most JMX clients do not accept to pass `null` for an argument so an
empty String is translated to null in that specific case.

Closes gh-8776
2017-06-01 14:31:07 +02:00
Stephane Nicoll bdf2b2e810 Merge branch '1.5.x' 2017-06-01 13:38:03 +02:00
Stephane Nicoll 9fc90a809f Add missing @Test annotations 2017-06-01 13:37:05 +02:00
Andy Wilkinson 5ef29653c7 Polish 2017-05-31 15:05:19 +01:00
Madhura Bhave d745b69630 Replace usages of EnvironmentTestUtils 2017-05-24 14:59:04 -07:00
Phillip Webb 05111a17b8 Polish 2017-05-23 17:04:44 -07:00
Andy Wilkinson d5438c299c Polish "Use try-with-resources to close resources automatically"
- Apply code formatting
- Use try-with-resources in many other places that were missed in the
  pull request

Closes gh-8045
2017-05-23 19:38:48 +01:00
rajadilipkolli 3e797c326a Use try-with-resources to close resources automatically
See gh-8045
2017-05-23 17:34:35 +01:00
Andy Wilkinson 9192db692b Use WebRequest rather than RequestAttributes in ErrorAttributes
This change aligns ErrorAttributes with ResponseEntityExceptionHandler
which takes a WebRequest as a parameter of its handleException method.
WebRequest extends RequestAttributes and provides access to much more
than just the request's attributes. For example request headers and
parameters are available from WebRequest.

Closes gh-7952
Closes gh-6555
2017-05-23 15:15:22 +01:00
Stephane Nicoll 895f06fdfa Polish 2017-05-23 15:23:38 +02:00
Rocky Shang 51d4e88537 Display unconditional classes in auto-config endpoint
Closes gh-9227
2017-05-23 15:23:21 +02:00
Stephane Nicoll 1a00692b27 Merge branch '1.5.x' 2017-05-23 10:52:31 +02:00
Stephane Nicoll d4a0fe5ff9 Polish "Fix configuration properties output for actuator"
Closes gh-9052
2017-05-23 10:48:45 +02:00
Wesley Stratton 7d6293f79d Fix configuration properties output for actuator
See gh-9052
2017-05-23 10:48:45 +02:00
Stephane Nicoll a1adcd9919 Merge branch '1.5.x' 2017-05-22 11:07:25 +02:00
Stephane Nicoll 4cc515054e Merge branch '1.4.x' into 1.5.x 2017-05-22 11:06:40 +02:00
Stephane Nicoll a59000354c Support for TransactionAwareCacheDecorator
This commit makes sure to unwrap any transaction aware cache before
collecting metrics for them.

Closes gh-8984
2017-05-22 11:05:39 +02:00
Eddú Meléndez ce0b1b242b Modify return on post /loggers to HTTP 204
This commit alter the return http status code from 200 to 204.

Closes gh-8919
2017-05-19 09:42:03 +02:00
Phillip Webb 302f038e84 Polish 2017-05-15 20:35:29 -07:00
Andy Wilkinson ee499b029a Merge branch '1.5.x' 2017-05-15 19:58:34 +01:00
Gytis Trikleris 00823d41a9 Log a warning if a health indicator throws an exception
Closes gh-9110
2017-05-15 19:53:55 +01:00
Stephane Nicoll 0e7b037750 Fix build failure 2017-05-14 18:47:54 +02:00
Phillip Webb fa4de13519 Rework ConfigurationPropertySources
Rework the ConfigurationPropertySources and related adapter classes to
help with performance. The ConfigurationPropertySources class now only
monitors for updates when `.attach` is used. The `.get` methods now
return the adapted version, but no longer checks to see if sources have
been added or removed on each call.

This commit also fixes a few caching issues and makes both the
`PropertyMapper` implementations true static singletons.

See gh-9000
2017-05-09 22:09:40 -07:00
Phillip Webb fd2e3b3505 Merge branch '1.5.x' 2017-05-09 21:55:31 -07:00
Phillip Webb 931ce15d7f Update copyright header dates 2017-05-09 21:43:52 -07:00
Phillip Webb 4a7dcc8786 Formatting 2017-05-09 21:43:24 -07:00
Stephane Nicoll 275bff39aa Remove deprecated code
Closes gh-8891
2017-05-05 14:32:09 +02:00
Madhura Bhave ba8bdd2683 Fix actuator path used in tests 2017-05-04 14:59:47 -07:00
Madhura Bhave 2519d73f5e Merge branch '1.5.x' 2017-05-04 13:58:52 -07:00
Madhura Bhave 3d836f7730 Fix test pollution 2017-05-04 12:20:21 -07:00
Madhura Bhave 189e07e9f3 Support values other than String in /env
Fixes gh-9079
2017-05-04 11:35:15 -07:00
Stephane Nicoll 2b4f2c6aba Making sure to stop embedded web servers in tests
Closes gh-9012
2017-05-03 12:04:57 +02:00
Stephane Nicoll 5121b848e1 Making sure to stop embedded web servers in tests
Closes gh-9012
2017-05-03 11:33:42 +02:00
Phillip Webb 8133b7f245 Merge branch '1.5.x' 2017-05-02 21:43:22 -07:00
Phillip Webb 4d4d03ab2c Merge branch '1.4.x' into 1.5.x 2017-05-02 21:33:33 -07:00
Phillip Webb 4a95b2f174 Polish 2017-05-02 20:39:45 -07:00
Stephane Nicoll 64dae5ec3a Merge branch '1.5.x' 2017-05-02 13:26:04 +02:00
Stephane Nicoll 035e27b1d1 Merge branch '1.4.x' into 1.5.x 2017-05-02 13:21:03 +02:00
Stephane Nicoll 8e5bf4b22a Polish CachePublicMetrics
CachePublicMetrics wasn't explicitly tested and was still using field
injection. This commit improves the situation in preparation of the fix
for gh-8984
2017-05-02 13:15:31 +02:00
Phillip Webb 6cdb02050d Reduce InMemoryAuditEventRepository default capacity
Lower the default capacity used in `InMemoryAuditEventRepository` from
4000 to 1000. This should help reduce memory consumption.

Fixes gh-9056
2017-05-01 22:31:39 -07:00
Stephane Nicoll f42998f5ca Revert "Refine validator and MVC validator configuration"
This commit reverts c9561f0 and 69a8c0d and effectivly fixes gh-8979 but
reintroduces the issue reported in gh-8495.
2017-04-28 11:12:09 +02:00
Madhura Bhave 6184e4154e Test correct binding in '/info' endpoint
Add a test to ensure that the updated configuration properties work
correctly binds environment sources in the `/info` endpoint.

Closes gh-7388
2017-04-27 14:34:29 -07:00
Madhura Bhave 866cf1dda7 Use new configuration properties in actuator
Update `spring-boot-actuator` to use the new configuration properties
support.

See gh-9000
2017-04-27 13:59:25 -07:00
Phillip Webb 45dd9f7144 Polish 2017-04-27 12:04:02 -07:00
Phillip Webb df82060cad Formatting 2017-04-27 10:12:31 -07:00
Stephane Nicoll 800eb010b1 Change the default JDBC connection pool to Hikari
Closes gh-6013
2017-04-27 16:11:45 +02:00
Vedran Pavic 720e801a76 Make Audit events MVC endpoint `after` parameter required
Closes gh-9002
2017-04-27 10:54:45 +02:00
Phillip Webb 06558675bb Polish 2017-04-25 09:45:14 -07:00
Madhura Bhave c2e5fd031a Replace usage of WebMvcConfigurerAdapter
Closes gh-8964
2017-04-24 15:31:39 -07:00
Spring Buildmaster 9768b0a8c2 Next Development Version 2017-04-21 08:32:01 +00:00
Phillip Webb 99a3ec8b74 Merge branch '1.5.x' 2017-04-20 16:01:58 -07:00
Phillip Webb 5f3d5fbec1 Remove public "skip path extension" constant
Remove the public constant to make it clearer that skipping path
extensions is really an internal Spring Boot concern.

See gh-8765
2017-04-20 13:31:04 -07:00
Spring Buildmaster d719d2cbbc Next Development Version 2017-04-20 12:46:19 +00:00
Phillip Webb 81fef71fcb Merge branch '1.5.x' 2017-04-19 22:48:46 -07:00
Phillip Webb c9561f031c Refine validator and MVC validator configuration
Update `ValidationAutoConfiguration` and `WebMvcAutoConfiguration` to
ensure as much as possible that only a single Validator bean of each
type is registered.

Validation auto-configuration now does the following:
- If no validator is found: Registers a `LocalValidatorFactoryBean`
  (providing both Spring and JSR validation)
- If the user defines a Spring & JSR validator: Backs off
- If the user defines only a JSR validator: Adapts it to a Spring
  validator (without exposing another JSR implementation)

WebMvcAutoConfiguration auto-configuration has been updated to make
MVC validation follow common Spring Boot patterns:
- If not validator beans are found (due to the user excluding
  ValidationAutoConfiguration) a new `mvcValidator` bean will be
  registered.
- If a single validator bean is found it will be used for MVC
  validation.
- If multiple validator beans are defined it will either use the one
  named `mvcValidator` or it will register a new `mvcValidator` bean

Any automatically registered `mvcValidator` bean will not implement
the JSR validator interface.

Finally, it is no longer possible to provide an MVC validator via a
`WebMvcConfigurer`.

Fixes gh-8495
2017-04-19 22:18:12 -07:00
Phillip Webb 9166bb5fae Polish 2017-04-19 12:00:36 -07:00
Phillip Webb 75f8e8a593 Fix actuator path used in tests
Fixup path changes that were missed during 1.5.x merge.
2017-04-19 11:58:07 -07:00
Phillip Webb 724be85b95 Polish 2017-04-19 11:57:48 -07:00
Stephane Nicoll b100caa041 Fix import 2017-04-19 11:18:57 +02:00
Phillip Webb 94209e2883 Merge branch '1.5.x' 2017-04-18 15:06:43 -07:00
Andy Wilkinson b9be0e3e0f Skip actuator path extension content negotiation
Allow `PathExtensionContentNegotiationStrategy` to be bypassed by
actuator endpoints. Prior to this commit calling `/loggers/com.aaa.cab`
would return a HTTP 406 response due to `.cab` being a known extension.

Fixes gh-8765
2017-04-18 14:56:11 -07:00
Phillip Webb 8eb79b3c0f Polish 2017-04-18 11:13:12 -07:00
Stephane Nicoll 56c68ca6cf Merge branch '1.5.x' 2017-04-18 10:43:08 +02:00
Stephane Nicoll 6c14420221 Merge branch '1.4.x' into 1.5.x 2017-04-18 10:42:48 +02:00
Stephane Nicoll 9a5346f29c Polish "Fix statsd metrics collection for names with ":""
Closes gh-8906
2017-04-18 10:40:14 +02:00
Odín del Río 9e705c83c8 Fix statsd metrics collection for names with ":"
Statsd server is ignoring malformed metrics. This change introduces
a basic sanitizing to metric names for avoid losing those metrics.

See gh-8906
2017-04-18 10:40:14 +02:00
Phillip Webb 383640d5ec Merge branch '1.5.x' 2017-04-17 22:15:33 -07:00
Phillip Webb f46d799f31 Polish 2017-04-17 22:08:51 -07:00
Madhura Bhave 757be57d48 Merge branch '1.5.x' 2017-04-17 15:25:27 -07:00
Madhura Bhave 3fe0b844a6 Make HealthMvcEndpoint conditional on missing bean 2017-04-17 14:49:45 -07:00
Madhura Bhave bcd79dd992 Move all actuators under `/application`
Context path can be configured via `management.context-path`.

Closes gh-6886
2017-04-14 15:15:44 -07:00
Stephane Nicoll b9d1f5e097 Harmonize Solr status health details
This commit renames the `solrStatus` property of the Solr health indicator
to `status` and its type. This is now an integer corresponding to the
status Solr sent rather than a String that can be "OK" when all is well.

Closes gh-8878
2017-04-13 18:40:47 +02:00
Phillip Webb c4cba6b0ea Merge branch '1.5.x' 2017-04-11 21:07:51 -07:00
Phillip Webb c97268981a Polish 2017-04-11 20:59:03 -07:00
Phillip Webb d301d0f4c3 Merge branch '1.4.x' into 1.5.x 2017-04-11 20:42:48 -07:00
Phillip Webb 758ddcd420 Polish 2017-04-11 20:17:23 -07:00
Madhura Bhave 971057705d Merge branch '1.5.x' 2017-04-11 15:57:10 -07:00
Madhura Bhave 535451f9e5 Merge branch '1.4.x' into 1.5.x 2017-04-11 15:54:01 -07:00
Madhura Bhave b2f0ebfcb8 Prevent empty json for parameters in trace endpoint
Fixes gh-8883
2017-04-11 15:30:39 -07:00
Stephane Nicoll bd28de09b0 Merge branch '1.5.x' 2017-04-11 15:30:18 +02:00
Stephane Nicoll eff35795cd Fix checkstyle violation 2017-04-11 15:29:52 +02:00
Stephane Nicoll 158b3dae16 Merge branch '1.5.x' 2017-04-11 14:57:19 +02:00
Stephane Nicoll b148b46751 Polish 2017-04-11 14:54:16 +02:00
Stephane Nicoll 2ef318c00d Polish "Add the ability to disable the trace filter"
Closes gh-8650
2017-04-11 14:46:57 +02:00
Colin Harrington d3e2e22f8c Add the ability to disable the trace filter
See gh-8650
2017-04-11 14:46:57 +02:00
Stephane Nicoll 82ac8b5ca1 Polish "Fix http status code with unknown log level"
Closes gh-8813
2017-04-11 13:29:53 +02:00
Eddú Meléndez cf08162148 Fix http status code with unknown log level
This commit changes the http status code to 400 when an unknown log level
is specified.

Closes gh-8798
See gh-8813
2017-04-11 13:23:41 +02:00
Stephane Nicoll 6399ed7869 Fix checkstyle rule 2017-04-10 14:20:50 +02:00
Stephane Nicoll 74be6ff0f1 Merge branch '1.5.x' 2017-04-10 13:41:04 +02:00
Stephane Nicoll a9b5e7c12a Merge branch '1.4.x' into 1.5.x 2017-04-10 13:38:27 +02:00
Stephane Nicoll 9d88e477f3 Fix Solr health indicator
This commit changes the solr health indicator to request the status of
all available cores, rather than invoking a generic ping on the admin
handler.

Recent versions of Solr now have a ping handler per core and the general
admin handler is gone, leading to incorrect health status. For backward
compatible reason the `solrStatus` attribute is kept to `OK` if all cores
are running properly (that's actually `0` behind the scenes).

Closes gh-8463
2017-04-10 13:38:08 +02:00
Andy Wilkinson 7a4b87be6b Merge branch '1.5.x' 2017-04-07 12:21:09 +01:00
Andy Wilkinson c74f0a70ca Merge branch '1.4.x' into 1.5.x 2017-04-07 12:14:47 +01:00
Andy Wilkinson 5dad7182db Address deprecation warnings 2017-04-07 12:01:01 +01:00
Vedran Pavic 2667b7f51c Upgrade to Hazelcast 3.8
Closes gh-8808
2017-04-05 14:21:00 +02:00
Phillip Webb 2de7e9c310 Merge branch '1.5.x' 2017-04-04 10:07:38 -07:00
Phillip Webb ad38776de3 Polish 2017-04-04 09:48:10 -07:00
Phillip Webb ddcb5ee328 Polish 2017-04-04 09:36:27 -07:00
Madhura Bhave 8bfd42e3f1 Add v2 content type to actuator endpoints
Closes gh-7968
2017-03-27 11:10:44 -07:00
dreis 5d85733378 Replace empty string concatenation with String.valueOf()
Closes gh-8686
2017-03-26 12:03:36 +02:00
Madhura Bhave 20f201b57a Flip default for management.add-application-context-header
Closes gh-8656
2017-03-24 16:21:29 -07:00
Madhura Bhave 6ad46db944 Merge branch '1.5.x' 2017-03-23 16:10:35 -07:00
Madhura Bhave cb38546d8a Document default trace includes
Closes gh-8654
2017-03-23 15:36:27 -07:00