Commit Graph

1387 Commits (703b7d9268ba81bf7e2fe91aa3b7ed6c7ba50817)

Author SHA1 Message Date
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
9 years ago
Ruben Dijkstra c84e09f611 Fix incorrect usage of Assert.notNull()
Closes gh-5931
9 years ago
Phillip Webb cf6212b955 Polish 9 years ago
Spring Buildmaster 819a9574a6 Next Development Version 9 years ago
Andy Wilkinson 3348ed5bb3 Make use of new GetMapping and PostMapping annotations
Closes gh-5277
9 years ago
Spring Buildmaster 376bbe68d8 Next Development Version 9 years ago
Dave Syer 0ec5b7f43b Fix some more tests 9 years ago
Dave Syer 95c78e4e4c Fix test 9 years ago
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.
9 years ago
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
9 years ago
Vedran Pavic 0b70710bbc Allow customization of AuditListener
Introduce `AbstractAuditListener` so that users can extended it to
replace the auto-configured default.

Fixes gh-5830
9 years ago
Johnny Lim 0efa0038c3 Polish
Closes gh-5815
9 years ago
Phillip Webb 590bd5c084 Fixup warnings 9 years ago
Phillip Webb 609cb52cd4 Move to relocated web classes
Refactor code to move from recently deprecated classes.

Closes gh-5822
9 years ago
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
9 years ago
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
9 years ago
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
9 years ago
Stephane Nicoll 5f41e82a89 Merge branch '1.3.x' 9 years ago
Stephane Nicoll 247685e992 Add missing `@Documented`
Closes gh-5786
9 years ago
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
9 years ago
Phillip Webb 93382648ab Formatting 9 years ago
Phillip Webb 79922360e1 Polish 9 years ago
Dave Syer 014883253a Merge remote-tracking branch 'origin/1.3.x' 9 years ago
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
9 years ago
Dave Syer de2c22efee Merge remote-tracking branch 'origin/1.3.x' 9 years ago
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
9 years ago
Andy Wilkinson 58dac43b8d Update TraceWebFilterAutoConfiguration to use constructor injection 9 years ago
Andy Wilkinson 13c01376b0 Merge branch '1.3.x' 9 years ago
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
9 years ago
Andy Wilkinson a2489b01aa Merge branch '1.3.x' 9 years ago
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
9 years ago
Phillip Webb 5881c9c74f Polish 9 years ago
Stephane Nicoll cc0fc07c0e Move `shell.*` to `management.shell.*`
This commit moves the `shell` namespace to `management.shell`

Closes gh-5703
9 years ago
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
9 years ago
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
9 years ago
Johnny Lim 030096c490 Polish
Closes gh-5661
9 years ago
Phillip Webb 7956e68224 Fix warnings 9 years ago
Johnny Lim a0c8d1f5b5 Polish 9 years ago
Phillip Webb ae249f7568 Merge branch '1.3.x' 9 years ago
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
9 years ago
Phillip Webb 3ca365cff0 Export MessageChannel metric writer
Update the auto-configured MessageChannelMetricWriter with
@ExportMetricWriter so that metrics are actually exported.

Fixes gh-5517
9 years ago
Phillip Webb 6550bb4cf1 Polish 9 years ago
Johnny Lim 3b5ecbd066 Polish
Closes gh-5627
9 years ago
Phillip Webb 01c9d72644 Polish 9 years ago
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
9 years ago
Stephane Nicoll 05ef0818f8 Polish contribution
Closes gh-5511
9 years ago
Huang YunKun 6a2ff3f02a Upgrade elasticsearch to 2.2.0
Closes gh-5443
9 years ago
Phillip Webb b398b3319c Rename @SpringApplicationTest -> @SpringBootTest
Rename @SpringApplicationTest to SpringBootTest and
@SpringApplicationContextLoader to @SpringBootContextLoader.

Fixes gh-5562
9 years ago
Phillip Webb 4d404b214c Migrate away from @SpringApplicationConfiguration
Refactor internal tests to no longer use @SpringApplicationConfiguration

See gh-5562
9 years ago
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
9 years ago
Phillip Webb 8a11620052 Fix failing test due to SPR-14093 9 years ago
Stephane Nicoll 928f2dfc91 Sanitize keys with 'token' by default
This commit updates `Sanitizer` to sanitize by default a key containing
`token`.

Closes gh-5462
9 years ago
Phillip Webb a3bfc29e6e Fix warnings 9 years ago
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
9 years ago
Michael Hunger 0658cc8aee Add Neo4j support
See gh-5458
9 years ago
Phillip Webb c28f552883 Migrate SpringJUnit4ClassRunner to SpringRunner
Replace all existing SpringJUnit4ClassRunner references with the new
SpringRunner alias.

Fixes gh-5292
9 years ago
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
9 years ago
Phillip Webb aef7f4bcb1 Restructure spring-boot-test packages
Create a new package structure for `spring-boot-test` and deprecate
existing classes.

Fixes gh-5293
9 years ago
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.
9 years ago
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
9 years ago
Phillip Webb 7942d9f787 Polish 9 years ago
Stephane Nicoll 2ae1435916 Polish 9 years ago
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.
9 years ago
Stephane Nicoll f699bd2435 Fix build
`@ManagedResource` annotated bean must be public.
9 years ago
Stephane Nicoll 2526a54e31 Polish contribution
Closes gh-5337
9 years ago
Anand Shah f6a32a1d5a Add `@LocalServerPort`
Closes gh-5262
9 years ago
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
9 years ago
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.
9 years ago
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
9 years ago
Phillip Webb a3f3de223f Polish 9 years ago
Johnny Lim 122270c990 Polish
Closes gh-5345
9 years ago
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
9 years ago
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
9 years ago
Stephane Nicoll aba9389b25 Polish contribution
Closes gh-5328
9 years ago
Anand Shah 395c36a132 Rename HealthIndicatorAutoConfigurationProperties
Closes gh-5326
9 years ago
Phillip Webb 73cbb2f40a Polish 9 years ago
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
9 years ago
Stephane Nicoll 7618802838 rebase to master 9 years ago
Meang Akira Tanaka 8bebe6dea9 Info endpoint
See gh-3492
9 years ago
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
9 years ago
Stephane Nicoll 7029ba521d Remove `management.dump_requests` property
Closes gh-4283
9 years ago
Andy Wilkinson ef5087c5ee Upgrade to Jackson 2.7.2
Closes gh-5081
9 years ago
Andy Wilkinson 355860fd09 Remove @Autowired from constructors where class has single constructor
Closes gh-5226
9 years ago
Stephane Nicoll 6741f05af1 Polish contribution
Closes gh-4903
9 years ago
Eddú Meléndez 98cc68364a Add Caffeine cache support
See gh-4899
9 years ago
Spring Buildmaster 225d877ab9 Next Development Version 9 years ago
Andy Wilkinson ccf7de904c Upgrade to Infinispan 8.1.2.Final
Closes gh-5245
9 years ago
Andy Wilkinson fcb5f03146 Upgrade to Hazelcast 3.6
Closes gh-5237
9 years ago
Andy Wilkinson 56487d23d6 Merge branch '1.3.x' 9 years ago
Vedran Pavic 6801e8208d Fix namespace declarations in Hazelcast xml's and make them consistent 9 years ago
Andy Wilkinson 44ddfcc7fa Upgrade copyright headers of all files changed in 2016 9 years ago
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.
9 years ago
Andy Wilkinson ef44d660bb Merge branch '1.3.x' 9 years ago
Andy Wilkinson ce71bd997c Remove redundant public modifier 9 years ago
Andy Wilkinson 8f1f12be6a Fix Checkstyle warning introduced in forward merge (852ba546) 9 years ago
Andy Wilkinson bee651fc17 Merge branch '1.3.x' 9 years ago
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
9 years ago
Andy Wilkinson 852ba54613 Merge branch '1.3.x' 9 years ago
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
9 years ago
Andy Wilkinson a3afc859bd Merge branch '1.3.x' 9 years ago
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
9 years ago
Phillip Webb 566008336c Polish 9 years ago
Andy Wilkinson f46862d186 Merge branch '1.3.x' 9 years ago
Andy Wilkinson f94e8bd287 Do not try to auto-configure Jolokia if Spring MVC is not on classpath
The Jolokia auto-configuration requires ServletWrappingController from
Spring MVC to be on the classpath. This commit updates the
auto-configuration to make it conditional on the presence of this
class.

Closes gh-5153
9 years ago
Dave Syer f2c34612f6 Fix javadocs on ManagementServerProperties 9 years ago
Phillip Webb 602a09332d Switch disallowedMethods test to use PATCH
Update the requestsWithDisallowedMethodsAreRejected test to use PATCH
rather than HEAD. The change is to allow support for Spring Framework
4.3 which will implicitly map HEAD requests to GET.

Pre-flight requests are also only for "non-simple" HTTP methods [1]
(i.e. anything but GET, HEAD, POST) so there is really no such a thing
as a pre-flight request for HEAD.

[1] https://www.w3.org/TR/cors/#resource-preflight-requests
9 years ago
Phillip Webb 89b7704977 Extract spring-boot-test.jar
Relocate the `org.springframework.boot.test` package from the
`spring-boot.jar` to `spring-boot-test.jar`.

Fixes gh-5184
9 years ago
Phillip Webb 4b55144d80 Polish 9 years ago
Phillip Webb a9afe0a944 Formatting 9 years ago
Andy Wilkinson d6e0b5a165 Use @DirtiesContext to avoid unwanted context caching in the tests
We rarely use the same configuration in multiple test classes, but
Spring’s Test framework caches each context by default. For projects
with large numbers of integration tests, this can lead to tens of
contexts being cached. This increases memory usage, live thread count,
etc for no benefit.

This commit adds @DirtiesContext to the integration tests in
spring-boot, spring-boot-autoconfigure, and spring-boot-actuator so
that the context is closed once the test class has completed.

See gh-5141
9 years ago
Stephane Nicoll da3b49e024 Polish contribution
Closes gh-3499
9 years ago
Eddú Meléndez 76f1ca4188 Add Couchbase support
Closes gh-3498
9 years ago
Stephane Nicoll b205e02e33 Upgrade to Spring Data Hopper M1
Closes gh-5120
9 years ago
Andy Wilkinson 11c9068d53 Merge branch '1.3.x' 9 years ago
Andy Wilkinson 607dba97f8 Only access parameters in WebRequestTraceFilter when they are included
Previously, WebRequestTraceFilter would call request.getParameterMap()
before deciding whether or not the parameters should be included in
the trace. For a POST request, this had the unwanted side-effect
of always reading the request body.

This commit updates WebRequestTraceFilter so that it checks that
parameters are to be included in the trace before calling
request.getParameterMap()

Closes gh-5089
9 years ago
Stephane Nicoll 1f106ddf8c Enable connection validation by default
Hikari and Commons DBCP2 are already validating that the connection is
valid before borrowing it from the pool. This commit makes that behaviour
consistent by enabling that feature for the Tomcat and Commons DBCP data
sources.

Since a validation query is required in those cases, the infrastructure
of `DataSourceHealthIndicator` has been merged in a single place: the
`DatabaseDriver` enum provides not only the driver class names but also
the validation query, if any.

Closes gh-4906
9 years ago
Stephane Nicoll ebffa493e4 Harmonize ConfigurationProperties bean name
When `@EnableConfigurationProperties` is defined, Spring Boot
automatically registers a bean in the context for each class specified
on the annotation. Previously, the name of the bean only included the
prefix which leads to conflict if two different classes use the same
prefix.

This commit changes the bean name structure to be <prefix>-<fqn> where
prefix is the prefix used on the annotation and <fqn> the fully qualified
name of the target class.

Closes gh-4395
9 years ago
Phillip Webb 94677b35f8 Use AssertJ in spring-boot-actuator
See gh-5083
9 years ago
Phillip Webb 516afcd2ca Polish 9 years ago
Stephane Nicoll 34d87df425 Clarify use of the `spring.datasource` prefix
Previously, Spring Boot mapped both `DataSourceProperties` and the actual
`DataSource` implementation to the same prefix. This results in a huge
amount of keys in the `spring.datasource` namespace  with no way to
identify those that are valid for the pooled data source in use.

This commit maps the four pooled data sources we support in four isolated
namespace, keeping `spring.datasource` only for the common settings.

These are `spring.datasource.tomcat`, `spring.datasource.hikari`,
`spring.datasource.dbcp` and `spring.datasource.dbcp2` for the Tomcat,
Hikari, Commons DBCP and Commons DBCP2 implementations respectively.

Closes gh-2183
9 years ago
Phillip Webb f276ff4bd0 Polish 9 years ago
Stephane Nicoll cafe1dc4c6 Polish contribution
Fix additional use of \n

Closes gh-4707
9 years ago
Stephane Nicoll 4ff5afc636 Polish contribution
Removing all deprecated code

Closes gh-4905
Closes gh-4917
9 years ago
Eddú Meléndez 7b9cd20e98 Remove deprecated code
See gh-4905
9 years ago
Phillip Webb fbaf209240 Move master to 1.4.0.BUILD-SNAPSHOT 9 years ago
Spring Buildmaster 504d3e97ba Next development version 9 years ago
Phillip Webb cf93f84e87 Polish 9 years ago
Andy Wilkinson 00f4538529 Don’t check that a Gauge’s value is a Number until it’s being read
Spring Boot’s metrics require all values to be Numbers. A Dropwizard
Gauge can have a non-Number value. Previously, to prevent this causing
a problem, MetricRegistryMetricReader would check the value of a Gauge
when it’s being added and ignore it if it had a non-Number value.
Unfortunately, retrieving the value of a Gauge can take a non-trivial
amount of time (hence CachedGauge) so this approach, while functional,
could be improved.

This commit updates the filtering to happen when a Metric is being
retrieved from MetricRegistryMetricReader (via findOne or findAll)
when its value is required anyway. At this point, any Gauge with a
non-Number value is ignored.

Closes gh-4874
9 years ago
Andy Wilkinson 2f24c1862a Polish contribution 9 years ago
mkwaczynski 3724db9ecc Include details in AuditEvent data in AuthenticationAuditListener
Closes gh-4976
9 years ago
Andy Wilkinson 69b60f6d8c Remove HalJsonMvcEndpoint’s redirect and add links to both paths instead
Previously, HalJsonMvcEndpoint used a redirect to go from path/ to path.
When the actuator’s configured to use a custom context path this
redirect was leading to an infinite redirect loop.

This commit removes the redirect in favour of updating the controller
advice to apply the links to requests for path and path/.

Closes gh-4853
9 years ago
Andy Wilkinson f5b973a242 Polish contribution
- Update copyright headers
 - Use kebab-case for the property name
 - Set the header unconditionally when the filter's registered

Closes gh-4320
9 years ago
Eddú Meléndez c219f5e57f Don't create ApplicationContextHeaderFilter when header is disabled
See gh-4320
Closes gh-4454
9 years ago
Andy Wilkinson 93ef795159 More use entrySet() rather than using keySet() and get(key)
This commit replaces some more occurrances of keySet() and get(key)
with more efficient usage of the map's entry set.

See gh-4813
9 years ago
mnhock 8f1f8dd680 Use entrySet() rather than using keySet() and then calling get(key)
Closes gh-4813
9 years ago
Andy Wilkinson 27a81e1463 Complete static final logger changes that were started in ec2f33f9
This commit completes the changes to consistently used static final
fields for Log instances that were started in ec2f33f9. Specifically it:

 - Removes this. when accessing logger fields that are now static
 - Renames some fields from log to logger
 - Makes some logger fields static

See gh-4784
9 years ago
Dave Syer 9510938120 Make springIntegrationPublicMetrics conditional on bean by name not type
By type is too restrictive and surprising for users who wanted to add their
own MetricReaderPublicMetrics for other reasons.
9 years ago
Spring Buildmaster 8db59059a5 Next Development Version 9 years ago
Johnny Lim c09a14a128 Fix typos
Closes gh-4806
9 years ago
Phillip Webb 5d311d6203 Polish 9 years ago
Kirill Vlasov ec2f33f986 Make loggers private static final
Apply consistency across all static loggers.

Closes gh-4784
9 years ago
Kirill Vlasov 786aacf2e9 Use Collections.isEmpty() instead of .size() == 0
Ensure that Collections.isEmpty() is used to check if there are no
elements in a collections. This is more explicit and can be faster than
calling .size().

Closes gh-4783
9 years ago
Dave Syer 471947b400 Be more defensive when instantiating custom ServerProperties
If the user provides their own ServerProperties bean we want to peek
at it to see if they set the port (and only that) when we are deciding
if the actuator context needs to be created. This happens very early
(in a @Condition) so we need to be very defensive. There are already
quite a few checks in place to prevent a ServerProperties bean from
being instantiated unless we really need it, and yet, when it is
we can do more.

This change creates the bean (and the ManagementProperties) in a
throwaway BeanFactory using the same BeanDefinition as the main
context. This ensures that when the main context bean is created
it will be in the "natural" order and binding to the Environment
can take place as normal.

Fixes gh-4631
9 years ago
Dave Syer c7c685f65f Disable hypermedia in actuator endpoints by default
This change permanently removes links from the endpoints that return
arrays or collections, and also disables them in the rest of the
endpoints (except /actuator) by default.

Fixes gh-4616
9 years ago
Andy Wilkinson 097e588109 Use more sensible defaults for OpenTsdbGaugeWriter's timeouts
Previously, the default RestTemplate that is used OpenTsdbGaugeWriter
was not used with its default configuration. Notably this meant that
it would have infinite connect and read timeouts. This is problematic
as it can cause metric writing to hang and block the scheduler for
performing any other tasks.

This commit updates OpenTsdbGaugeWriter to use a default connect
timeout of 10 seconds and a default read timeout of 30 seconds. A
constructor has been added to ease the configuration of these
timeouts. The existing option of providing your own RestTemplate
(via setRestTemplate) remains.

Closes gh-4698
9 years ago
Eddú Meléndez 1b81d9f0b5 Add support for server.server-header property
Add a `server.server-header` property which can be used to override the
`server` header usually sent back automatically by Tomcat/Jetty or
Undertow.

See https://www.owasp.org/index.php/Securing_tomcat for background.

Fixes gh-4461
Closes gh-4504
9 years ago
Vedran Pavic c05432d221 Move publisher injection to abstract listeners
Push up publisher injection from AuthenticationAuditListener and
AuthorizationAuditListener to the abstract superclasses.

Closes gh-4625
9 years ago
Vedran Pavic f8090d94b2 Add AbstractHealthAggregator.aggregateDetails
Extract aggregate details logic to a protected method that can be
overridden if required.

Closes gh-4674
9 years ago
mnhock fcf6e5d6eb Prefer valueOf() to create Number values
Update Long/Integer constructor calls with `valueOf` which can make use
of global caches.

Closes gh-4688
9 years ago
Phillip Webb 0489a3b4de Polish 9 years ago
Phillip Webb 2d2e4eea82 Merge branch '1.2.x' 9 years ago
Stephane Nicoll 66fe95369c Polish doc
See gh-4743
9 years ago
Phillip Webb 2694605a4d Polish 9 years ago
Stephane Nicoll 59cb5cf8d9 Merge branch '1.2.x'
# Conflicts:
#	spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json
#	spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
9 years ago
Stephane Nicoll ce2346b087 Reintroduce endpoints.metrics.filter.enabled
Commit 8c14009 removed the endpoints.metrics.filter.enabled property so
that endpoints.metrics.enabled is used for both disabling the endpoint
and the servlet filter that records interactions.

This was an unfortunate decision as it was no longer possible to only
disable the servlet filter. The endpoints.metrics.filter.enabled property
has therefore been restored.

Closes gh-4365
9 years ago
Dave Syer 21d6c73539 Fix checkstyle 9 years ago
Dave Syer 8b97c3b342 Add nonheap metrics to /metrics endpoint
Fixes gh-4712
9 years ago
Stephane Nicoll 7b2afbdf13 Polish 9 years ago
Johnny Lim ec7fed1ecc Polish
Closes gh-4677
9 years ago
Andy Wilkinson ee47ae4d20 Ensure that 5xx responses to unmapped requests produce a single metric
Previously, each 5xx response to a request that used a path variable
would result in a metric being recorded that contained the path
variable. Therefore, if a different path variable was included in each
request, a new metric would be recorded for each request. This is
problematic as it can lead to the metrics being flooded with unwanted
entries.

This commit updates MetricsFilter to treat 5xx responses sent before
mapping has occurred in the same way as 4xx and redirect responses.
A single metric, counter.status.500.unmapped, is now used.

Closes gh-4377
9 years ago
Vedran Pavic d9f15636d0 Fix use of == in EndpointWebMvcHypermediaManagementContextConfiguration
Closes gh-4502
Closes gh-4536
9 years ago
Johnny Lim a4baacc549 Remove a redundant setUseSuffixPatternMatch(false)
Closes gh-4656
9 years ago
Andy Wilkinson 8e0d3ed0eb Don’t return 404 when metric or env regex matches entry with null value
Previously, if a regular expression was used when calling the metrics or
environment endpoints, a metric or property with a null value would
result in a 404 response.

This commit updates the two affected endpoints so that any metric or
property whose name matches the regular expression but has a null value
is ignored. This allows all of the matching metrics or properties with
non-null values to be returned in a 200 OK response.

Closes gh-4552
9 years ago
Dave Syer 6ec767437a Fix server.error.path reference in error controller 9 years ago
Stephane Nicoll 7d6f63ae34 Add redirection to actuator endpoint
If a request to the actuator endpoint ends with a slash with Spring
HATEOAS on the classpath, an empty array of links is returned whereas
a request without the slash returns a response with all the expected
links to the actuator's other endpoints.

This commit adds an automatic redirection so that both URIs return the
expected result.

Closes gh-4575
9 years ago
Dave Syer 2de48a35ab Make /error the error page in child context as well as parent
If user set the management.port *and* the management.context-path
then the /error path was in the wrong place because formerly it
was implemented (in this case) by an MvcEndpoint. If we
switch it to a regular @Controller (which are now supported in the
child context if there is one) then it won't disappear under the
management.context-path.

Also use lazy request matching in ignores as well as secure paths.
The problem was that the ignores were constructed eagerly from the
actuator paths before they were available (the EndpointHandlerMapping
needs to be lazily accessed to avoid a security-induced bean creation
cascade).

Fixes gh-4624
9 years ago
Dave Syer 4488bac4c3 Remove server.context-path from actuator endpoints if port set
If the user sets the management.port, he wants some of the
server.* properties, but not the context-path. This change
restores the behaviour in 1.2.x.

Fixes gh-4401
9 years ago
Dave Syer dd7d587ea8 Add tests to assert behaviour of actuator endpoints with context path
See gh-4401
9 years ago
Dave Syer 7d04ca1e1b Add tests to assert behaviour of actuator endpoints with context path
See gh-4401
9 years ago
Stephane Nicoll 091478e0fd Disable ehcache statistics if necessary
`EhCacheStatisticsProvider` uses the `StatisticsGateway` API introduced
in ehcache 2.7 (march 2013). If an older ehcache version is present, we
should back-off as this class is not available.

Closes gh-4621
9 years ago
Johnny Lim da16d6d306 Polishing
Closes gh-4503
9 years ago
Spring Buildmaster 3f6f57a80e Next Development Version 9 years ago
Johnny Lim 4369493f8d Polish 9 years ago
Phillip Webb e9440ad5b5 Formatting 9 years ago
Stephane Nicoll ba2aea4ef1 Polish contribution
Closes gh-4456
9 years ago
Eddú Meléndez 41300c35ab Add timeout configuration for CRaSH
Closes gh-4325
9 years ago
Dave Syer 8749fc745b Disallow all extensions in actuator endpoints (except .json)
Along with the recent change in Spring to use content-disposition
"inline" (which prevents the download), it also makes sense to limit
the extensions allowed by the actuator endpoints. Really there *is*
no extension for these endpoints, but since all of them explicitly
produce JSON we can add .json for browsers as a convenience in case
the app would otherwise choose to send XML.

Fixes gh-4402
9 years ago
Phillip Webb 09b5222f52 Disable suffix pattern matching for Endpoints
Update EndpointHandlerMapping so that setUseSuffixPatternMatch is set
to false. This prevents URLs of the form /beans.json from returning
results and provides another line of defense against RDF attacks.

Fixes gh-4402
9 years ago
Johnny Lim 4c1398148b Polish docs
Closes gh-4433
9 years ago
Phillip Webb a3fac37904 Fix checkstyle error 9 years ago
Phillip Webb 287a62c8f3 Update Johannes Edmeier author attribution
Congratulations to Johannes Edmeier on getting married!
9 years ago
Johannes Edmeier a1b1cdb18f Improve resource handling in LogFileMvcEndpoint
Update `LogFileMvcEndpoint` to use a `ResourceHttpRequestHandler` when
serving the log file resource. This gives support for requesting parts
of the logfile via the HTTP Range header. Requests with the
`If-Modified-Since` header are now also handled correctly.

Closes gh-4333
9 years ago
Tommy Ludwig d8247657a0 Auto-configure CassandraHealthIndicator
Add auto-configuration for the CassandraHealthIndicator. Also update
the implementation to use CassandraOperations rather than
CassandraAdminOperations.

Closes gh-4409
9 years ago
Phillip Webb 0bac6ebda7 Fix typo
See gh-4419
9 years ago
Stephane Nicoll 3311419a08 Fix typo
See gh-4419
9 years ago
Rob Winch c6e08eb883 Secure actuator when all endpoints are sensitive
Previously if every actuator endpoint was marked as sensitive, then all
endpoints were marked as permitted.

This commit ensures that if all endpoints are marked as sensitive, then
all the endpoints are secured.

Fixes gh-4368
Closes gh-4383
9 years ago
Phillip Webb 8c642bec74 Support global endpoint.sensitive override
Add support for an `endpoint.sensitive` property that can be used to
override the endpoint `sensitive` default.

Fixes gh-4419
9 years ago
Phillip Webb 332c6911cf Polish 9 years ago
Phillip Webb aa8d0dd072 Add HAL test for endpoints.enabled=false 9 years ago
Phillip Webb b1b3fc6639 Use consistent MvcEndpoint class names
Rename HAL and docs MVC endpoints so that classnames consistently end
with MvcEndpoint. Also rename integration tests so that they are grouped
together in the IDE.
9 years ago
Vedran Pavic a0c696b17b Allow security AuditListener overrides
Introduce `AbstractAuthenticationAuditListener` and
`AbstractAuthorizationAuditListener` classes so that users can
extended them to replace the auto-configured defaults.

Closes gh-4406
9 years ago
Phillip Webb 564cbfe96c Add missing @param tag
See gh-4415
9 years ago
Phillip Webb bd20b5419e Consider prefixes when sanitizing `/configprops`
Update ConfigurationPropertiesReportEndpoint so that property prefixes
are also considered when sanitizing values.

Fixes gh-4415
9 years ago
Stephane Nicoll bd8521c1ab Polish contribution
Closes gh-4356
9 years ago
邱占波 35417622e6 Add thread total started count to SystemPublicMetrics
See gh-4356
9 years ago
Phillip Webb 6c2ea4648f Polish 9 years ago
Stephane Nicoll 7a665c5f58 Merge branch '1.2.x' 9 years ago
Stephane Nicoll 8c140092b6 Fix key to disable the metrics filter
Commit d0cf6b5 introduced a `endpoints.metrics.filter.enabled` property
key meant to disable the filter. Unfortunately, the `endpoints.metrics`
namespace is already managed so setting this property will fail.

We now use the same key than the one used to disable the metrics
endpoint.

Closes gh-4365
9 years ago
Stephane Nicoll 8188060edf Fix broken build 9 years ago
Dave Syer cc3f673874 Narrow range of events listened for in security audit
The InteractiveAuthenticationSuccessEvent is always shadowed by a
regulat AuthenticationSuccessEvent, so there's no need to listen for
all AbstractAuthenticationSuccessEvents.

Fixes gh-4355
9 years ago
Dave Syer 96fcd49e2e OpenTsdbMetricWriter -> OpenTsdbGaugeWriter 9 years ago
Dave Syer db03e8ea50 Fix sample and tidy up MetricWriter/GaugeWriter
The metric export configuration was still using the MetricWriter
interface where it should be using GaugeWriter
9 years ago
Dave Syer 03c56b4cf1 Split MetricWriter into 2 interfaces covering counters and gauges
This way the MetricCopyExporter can make a sensible choice about
what to do with counter metrics, and cache the latest values, so that
they can be properly incremented.

Fixes gh-4305
9 years ago
Andy Wilkinson 02d7e2826c Don’t call ignoring.antMatchers([]) as empty array now maps to /**
Previously, if security.ignored was set to none and the error controller
was disabled, there would be no paths to ignore and we would call
IgnoredRequestConfigurer.antMatchers with an empty array. While a bit
pointless, this had no effect on Spring Security’s configuration.

This behaviour has changed in the latest 4.0.3 snapshots [1]. An empty
array passed to IgnoredRequestConfigurer.antMatchers now maps to /**. As
Spring Boot configures its ignored paths with highest precedence this
means that security is now disabled for every path.

This commit updates both the management security and application
security configuration to avoid calling antMatchers with an empty
array, thereby ensuring that we don’t inadvertently ignore every path.
Even if the change to Spring Security is reverted we can keep this
change. The behaviour will remain the same and, arguably, it makes the
intent of our configuration clearer.

Closes gh-4345

[1] 8663ac4173
9 years ago
Stephane Nicoll 86c753a149 Temporary fix the build
(I mean it this thime)

See gh-4345
9 years ago
Andy Wilkinson 79d99e1847 Update ShellPropertiesTests to expect whitespace to be trimmed
The latest Spring Framework 4.2.3 snapshots appear to be trimming
whitespace as part of the binding process. This commit updates the
test's expectations accordingly.
9 years ago
Andy Wilkinson aa3313cfc5 Update NamePatternFilter to detect regular expression character class
Previously, NamePatternFilter looked for “*”, “$”, “^”, or “+” when
trying to identify a string as being a regular expression. This meant
that it missed the use of a character class ([a-z], for example). This
commit adds “[“} to the list of characters that are considered to be
part of a regular expression.

Closes gh-4233
9 years ago
Stephane Nicoll 601225027f Merge branch '1.2.x' 9 years ago
Stephane Nicoll 2e2ebeb9fa Allow PORTFILE to always override the file to use
Previously, the `PORTFILE` system property was not checked if the
`EmbeddedServerPortFileWriter` was created using the default constructor.

This had the effect to prevent overriding of the port file when this
listener is created without any file or via `META-INF/spring.factories`.

Closes gh-4254
9 years ago
Johnny Lim 71c8a114f1 Make response headers optional in /trace endpoint
Update `WebRequestTraceFilter` so that the response respects the
TraceProperties.Include.RESPONSE enum.

See gh-3948
Closes gh-4242
9 years ago
Andy Wilkinson 0862ad7f52 Polishing: remove dead code 9 years ago
Andy Wilkinson 2109559f37 Ensure that, where appropriate, actuator endpoints always produce JSON
Previously, the Actuator’s endpoints did not specify a produces
attribute on their request mappings. With Jackson’s XML binding on the
classpath, this would lead to requests made by a browser receiving
application/xml responses (due to the Accept header indicating that
application/xml is preferred). This was problematic as some of the
response payloads were not legal xml. Problems included XML tags
beginning with ‘\’ or containing ‘#’.

This commit updates the endpoints to specify that they produce
application/json. The environment and metrics endpoints have also been
updated so that always return a JSON object, even when they are
returning a single entry. This consistency avoids problems where
clients may not consider a single scalar value to be legal JSON.

Closes gh-2449
9 years ago
Stephane Nicoll 4ae6d7c97e Remove outdated key
See gh-3696
9 years ago
Johnny Lim f67b6a233a Remove unused property in TraceProperties
Closes gh-4241
9 years ago
Phillip Webb 634bb770b2 Organize imports with new settings
See gh-4234
9 years ago
Phillip Webb 1e4d974ec0 Merge remote-tracking branch 'local12x/1.2.x' 9 years ago
Phillip Webb a79131f8d2 Organize imports with new settings
See gh-4234
9 years ago
Spring Buildmaster 2b38a861e3 Next Development Version 9 years ago
Phillip Webb 7e99d08473 Fail startup if management server can't start
Update EndpointWebMvcAutoConfiguration to no longer catch and ignore
EmbeddedServletContainerExceptions. Since commit 764e34b9, starting a
management on a different port is not even attempted when running in a
classic servlet container. This means that the catch/log logic (which
was originally added in 45315a97) is no longer necessary, and only
serves to hide genuine problems.

Fixes gh-4064
9 years ago
Wallace Wadge e3315d2252 Allow TraceWebFilter to trace more attributes
Update TraceWebFilter to optionally trace more details from the
HttpServletRequest/HttpServletResponse. The `management.trace.include`
property can be used to change what aspects are logged.

Closes gh-3948
9 years ago
Andy Wilkinson 17fde264e2 Merge branch '1.2.x' 9 years ago
Andy Wilkinson e4895f8fde Disable child context's /error endpoint if disabled in parent
Previously, EndpointWebMvcChildContextConfiguration would attempt to
create a /error endpoint, irrespective of whether or not the parent
had such an endpoint. If the endpoint was disabled in the parent this
would cause a failure due to the absence of an ErrorAttributes bean.

This commit updates EndpointWebMvcChildContextConfiguration to make
the creation of its /error endpoint conditional on the existence of
an ErrorAttributes bean.

Closes gh-4164
9 years ago
Phillip Webb 6333426cbf Reformat package-info.java files with Eclipse Mars 9 years ago
Phillip Webb 04074fece1 Merge branch '1.2.x' 9 years ago
Phillip Webb 94736719f1 Reformat package-info.java files with Eclipse Mars 9 years ago
Stephane Nicoll b9c885f5d2 Polish
Closes gh-4118
9 years ago
Marten Deinum bad8c1bee8 Added support for the DB2 AS400 Driver
Closes gh-4115
9 years ago
Phillip Webb c9fb9916b8 Reformat code using Eclipse Mars 9 years ago
Phillip Webb e473364e4e Merge branch '1.2.x' 9 years ago
Phillip Webb 6ab376e2e8 Reformat code use Eclipse Mars 9 years ago
Andy Wilkinson 08aa6f788d Merge branch '1.2.x' 9 years ago
Andy Wilkinson 9a703ab4d1 Correct quotation marks in spring-boot-actuator’s README
Closes gh-4095
9 years ago
Andy Wilkinson d793d5abcb Work around intermittent failure caused by SPR-13079
See gh-4098
9 years ago
Andy Wilkinson 6387f36efa Work around MockMvc bug (SPR-13079) that has only been fixed in 4.2
See gh-4098
9 years ago
Andy Wilkinson b7719a131b Merge branch '1.2.x' 9 years ago
Andy Wilkinson b8b4ea489e Improve MetricsFilter’s handling of async requests
Previously, MetricsFilter would treat async requests the same as
sync requests and would record their response status as soon as the
request had been processed by the filter chain. This would result in a
200 response being recorded and the actual response status produced by
the async processing being ignored. Furthermore, the time that was
recorded for the request would not include the time take for any async processing.

This commit updates MetricsFilter to check whether or not an async
request has been started before it records the metrics for the request.
In the event of an async request having been started no metrics are
recorded. Instead, the StopWatch is stored in a request attribute that
is then retrieved during the filtering of the request’s async
dispatch(es). Once the async processing has completed (isAsyncStarted()
returns false), the StopWatch is stopped, removed from the request’s
attributes and the metrics for the request are recorded.

Closes gh-4098
9 years ago
Stephane Nicoll 7d182028af Remove unecessary modifier 9 years ago
izeye a13b23e7f8 Polish
Closes gh-4087
9 years ago
Phillip Webb 5e58645202 Log warning for template folder not found problems
Update template auto-configurations to log a warning message rather
than throw an exception if the template folder cannot be found.

Fixes gh-4075
9 years ago
Phillip Webb 6a31c1dda1 Include debug message on management context fail
Update EndpointWebMvcAutoConfiguration to log exception details at DEBUG
in addition to the WARNING message when the child context fails to
start.

See gh-4064
9 years ago
Phillip Webb e272b3a957 Introduce AbstractEndpointMvcAdapter
Pull up functionality from EndpointMvcAdapter to a new
AbstractEndpointMvcAdapter which doesn't define any @RequestMappings and
update HealthMvcEndpoint to make use of it.
9 years ago
Phillip Webb c3b7764b72 Polish 9 years ago
Stephane Nicoll b2c3e7e2ed Rename error.* properties to server.error.*
Closes gh-4050
9 years ago
Dave Syer 4b1389179d Attempt to fix test failures caused by ordering issues 9 years ago
Dave Syer e1070cce07 Check authorities of user in HealthMvcEndpoint
We need to be a bit cautious about whether Spring Security is on
the classpath or not, but if it is we can test for the admin role
(as specified in `management.security.role`).

Fixes gh-4060
9 years ago
Dave Syer 972557851a All MVC endpoint paths to be separately customized from the id
This change applies only to "standard" MVC endpoints (not the extended
ones like /env and /jolokia which already have this feature). Allows
users to supply an endpoints.{name}.path.

Fixes gh-2790
9 years ago
Phillip Webb 5cbb81c64f Fix management security when using different port
Update ManagementWebSecurityAutoConfiguration to reinstate lazy creation
of EndpointHandlerMapping from the EndpointPathRequestMatcher.

Fixes a regression introduced in eb2984781 and picked up my one of the
sample integration tests.

Fixes gh-4059
9 years ago
Andy Wilkinson 2964fd28a0 Polishing 9 years ago
Dave Syer 933aad3c06 Make checkstyle happier 9 years ago
Dave Syer c8021fa526 Comment out logback config 9 years ago
Dave Syer eb29847814 Hone the security rules for actuator endpoints
Takes into account the fact that the new /actuator endpoint sometimes
loses its path (it is "" relative to a non-empty management context path).

Fixes gh-4059
9 years ago
Stephane Nicoll 623fcfeff1 Properly guard cache statistics providers
Previously, a `NoClassDefFoundError` could be thrown if EhCache or Guava
is on the classpath without `spring-context-support` as the respective
cache statistics provider both needs the implementation and the spring
abstraction implementation.

The `@ConditionalOnClass` definition has been updated to properly guard
those beans.

Closes gh-3960
9 years ago
Andy Wilkinson 0d1729cb65 Fix Checkstyle warning 9 years ago
Andy Wilkinson 64bcba47a9 Polish contribution
- Add @author tag
 - Remove unnecessary final modifiers
 - Avoid writing to volatile field when new gauge is used

Closes gh-3977
9 years ago
Jay Anderson 3fb0ae3e3b Register dropwizard gauges once and then update them
The previous implementation would remove and add a new Gauge each time
a metric was written. After this change the Gauge is registered once
and the value is updated on subsequent calls.
9 years ago
Andy Wilkinson ff5e4631e3 Add MockMvc-based integration tests for management.security.enabled
See gh-3997
9 years ago
Phillip Webb 69d57f9a35 Polish 9 years ago
Phillip Webb fa040c9e26 Fix tests failing on Windows 9 years ago
Phillip Webb 3b93a82dd6 Support relaxed HealthMvcEndpoint status mappings
Update HealthMvcEndpoint so that relaxed names can be used as keys in
the `endpoints.health.mapping` property.

Fixes gh-2465
9 years ago
Phillip Webb a168670a8d Use static Patterns in MetricsFilter
Update MetricsFilter to use static `Pattern` instances for regex
replacements rather than compiling them each time.

Fixes gh-3996
9 years ago
Phillip Webb 57a698f388 Fix broken Cassandra tests
See gh-2064
9 years ago
Julien Dubois c401330901 Add Cassandra support
Add auto-configuration support and health checks for Cassandra and
Spring Data Cassandra.

Fixes gh-2064
Closes gh-2214
9 years ago
Andy Wilkinson c55900b433 Simplify Jackson-related auto-configuration for HATEOAS and Data REST
This commit simplifies the Jackson-related auto-configuration that’s
applied when Spring HATEOAS and Spring Data REST are on the classpath.

Previously, Boot used Jackson2HalModule to apply the HAL-related
ObjectMapper configuration to the context’s primary ObjectMapper. This
was to allow HAL-formatted responses to be sent for requests accepted
application/json (see gh-2147). This had the unwanted side-effect of
polluting the primary ObjectMapper with HAL-specific functionality.
Furthermore, Jackson2HalModule is an internal of Spring HATEOAS that
@olivergierke has asked us to avoid using.

This commit replaces the use of Jackson2HalModule with a new approach.
Now, the message converters of any RequestMappingHandlerAdapter beans
are examined and any TypeConstrainedMappingJackson2HttpMessageConverter
instances are modified to support application/json in addition to their
default support for application/hal+json. This behaviour can be disabled
by setting spring.hateoas.use-hal-as-default-json-media-type to false.
This property is named after Spring Data REST’s configuration option
which has the same effect when using Spring Data REST. The new property
replaces the old spring.hateoas.apply-to-primary-object-mapper property.

Previously, when Spring Data REST was on the classpath,
JacksonAutoConfiguration would be switched off resulting in the context
containing multiple ObjectMappers, none of which was primary.

This commit configures RepositoryRestMvcAutoConfiguration to run after
JacksonAutoConfiguration. This gives the latter a chance to create its
primary ObjectMapper before the former adds its ObjectMapper beans to
the context.

Previously, the actuator’s hypermedia support assumed that the
HttpMessageConverters bean would contain every HttpMessageConverter
being used by Spring MVC. When Spring HATEOAS is on the classpath this
isn’t the case as it post-processes RequestMappingHandlerAdapter beans
and adds a TypeConstrainedMappingJackson2HttpMessageConverter to them.
This wasn’t a problem in the past as the primary ObjectMapper, used by a
vanilla MappingJackson2HttpMessageConverter, was configured with Spring
HATEOAS’sJackson2HalModule. Now that this pollution has been tidied up
the assumption described above no longer holds true. MvcEndpointAdvice,
which adds links to the actuator’s json responses, has been updated
to look at the HttpMessageConverters of every
RequestMappingHandlerAdapter when it’s trying to find a converter to
use to write a response with additional hypermedia links.

Integration tests have been added to spring-boot-actuator to ensure
that the changes described above have not regressed the ability to
configure its json output using spring.jackson.* properties (see
gh-1729).

Closes gh-3891
9 years ago
Phillip Webb 676efe7ad6 Fixup following package auto-configuration moves
A string based exclude was missed in commit c629813165.

See gh-4002
9 years ago
Simon Buettner 70031cca66 Add statsd metric export auto-configuration
Update MetricExportAutoConfiguration to auto-configure statsd metrics
export when a `spring.metrics.export.statsd.host` property is set.

Closes gh-3719
9 years ago
Thomas Badie 2fd1cacbf3 Fix synchronization issue in OpenTSDBMetricWriter
Closes gh-4010
9 years ago
Phillip Webb c629813165 Rationalize Spring Data auto-configurations
Relocate several auto-configuration classes to `...autoconfigure.data`
to make it clearer that they are Spring Data specific.

Also moved `EntityManagerFactoryBuilder` to `spring-boot` since it is
generally useful and doesn't need to be directly tied to the
auto-configuration module.

Fixes gh-4002
9 years ago
Andy Wilkinson d10dd13714 Fix deprecation warning in ConfigurationPropertiesReportEndpoint 9 years ago
Spring Buildmaster 9409c49c10 Next development version 9 years ago
Phillip Webb e674d751de Polish Javadoc 9 years ago
Phillip Webb e07df7e4c6 Remove redundant modifiers 9 years ago
Phillip Webb 460ca75fce Polish newline at end of file 9 years ago
Phillip Webb d09805fd75 Polish license headers 9 years ago
Phillip Webb 6e29ee4557 Polish 9 years ago
Phillip Webb 67402405db Reformat code 9 years ago
Phillip Webb 2615990ffb Organize imports 9 years ago
Phillip Webb 0335053139 Merge branch '1.2.x' 9 years ago
Phillip Webb 15686ed4fd Reformat code 9 years ago
Phillip Webb 690da89c82 Fix warnings 9 years ago
Phillip Webb 60b8cb8a47 Fix package tangle in spring-boot-actuator
Introduce ManagementServletContext interface as a facade for
ManagementServerProperties to resolve the package tangle between
`o.s.boot.actuate.endpoint.mvc` and `o.s.boot.actuate`

Fixes gh-3887
9 years ago
Phillip Webb 4aa2fed48b Revert "configure JRE that is different from compiler target level"
This reverts commit 678f36cfef.
9 years ago
Phillip Webb 6193b640a4 Polish 9 years ago
Andy Wilkinson 1f202e3e47 Upgrade to HAL Browser 9f96c74
Closes gh-3880
9 years ago
Stephane Nicoll 8f520dafc7 Remove hard-coded list of values in description
Since the meta-data now provide an explicit support for value hints, we
should not copy/paste them in the description as the IDE is able to
process them any way it wants.

Closes gh-3863
9 years ago
izeye 3ec97c1bb9 Make metric type more sensible
Closes gh-3532
9 years ago
izeye e2119d3329 Fix typos
Closes gh-3809
9 years ago
Dave Syer 9303efd435 Allow counter names like counter-foo
Checking for a prefix "counter." is more correct than "counter" because
the readers (repositories) assume the former prefix is there.

Fixes gh-3801
9 years ago
Martin Lippert 678f36cfef configure JRE that is different from compiler target level 9 years ago
Stephane Nicoll 7c0c953f81 Add value alias for SpringApplicationConfiguration
Given that Spring Boot uses java config accross the board, a new `value`
attribute is now aliased to the existing `classes` attribute such that
one could write the following:

@SpringApplicationConfiguration(MyConfig.class)
public class MyTest {}

Closes gh-3635
9 years ago
Stephane Nicoll a6f8586270 Merge branch '1.2.x'
Conflicts:
	spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java
9 years ago
Stephane Nicoll 11b82cc6fe Properly guard DB health indicator
The DataSource health indicator uses `JdbcTemplate` behind the scenes
but nothing was checking that it is actually available.

`DataSourcesHealthIndicatorConfiguration` is now disabled if
`spring-jdbc` is not on the classpath.

Fixes gh-3765
9 years ago
Dave Syer 56115b9baa Fix broken test (use web app context) 9 years ago
Dave Syer 84a3e3827b Ensure tomcat on the classpath does not imply web application 9 years ago
Stephane Nicoll 9d2d34216b Remove references to endpoints.hal
See gh-3696
9 years ago
Andy Wilkinson dad0574fd5 In absence of HAL browser, serve browsers JSON from actuator entry point
Following the changes made to combines the /links and /hal endpoints
into a single /actuator endpoint, a web browser accessing /actuator
would receive a 406 response if HAL browser was not on the classpath.

This commit updates the /actuator main entry point so that it will
serve JSON to a web browser when HAL browser is not on the classpath.

The actuator's embedded documentation has also been updated to reflect
the recent changes.

Closes gh-3696
9 years ago
Andy Wilkinson 25709385e6 Update Hypermedia samples following /hal and /links being combined
See gh-3696
9 years ago
Andy Wilkinson 58db5a3889 Combine /links and /hal into a single /actuator endpoint
This commit provides a single endpoint, /actuator, that serves HTML
(the HAL browser) or JSON depending on the request’s accept header
that enables discovery of all of the actuator’s other endpoints.

When the management context path is configured, the /actuator endpoint
moves to the configured path, e.g. if the management context path is
set to /management, the actuator endpoint will be available from
/management.

Closes gh-3696
9 years ago
Phillip Webb 28f32da74f Don't user root path for HAL endpoints
Update LinksMvcEndpoint and HalBrowserMvcEndpoint so that no longer try
to use the `/` context path. Links are now available from `/links` and
the HAL browser is available from `/hal`.

The actuator HAL browser now works with either WebJars or the Spring
Data version. It also now transforms the initial HTML so that the
form is pre-populated with `/links`.

When using Spring Data's HAL browser, the root includes a link to
`/links` with a rel of `actuator`.

See gh-3621
9 years ago
Phillip Webb 44aacd9559 Polish 9 years ago
Phillip Webb 8d92236eea Polish 9 years ago
Stephane Nicoll c25c07dfdd Remove dead code
ConfigurationPropertiesReportEndpoint parses the meta-data to inspect
entities that have potential cycles in them. The whole logic is based on
the lookup of `META-INF/spring-configuration-metadata.json` files on the
classpath. Unfortunately, the lookup instruction had a typo and did not
retrieve any file.

Surely that code was written with a clear intention in mind but it was
effectively dead code outside tests so it has been removed.

Closes gh-3310
9 years ago
Stephane Nicoll 7c9f2ae19c Polish
See gh-3555
9 years ago
Arthur Kalimullin b7b6e84d4b Add firebird specific health query
Closes gh-3555
9 years ago
Stephane Nicoll bf0b857357 polish 9 years ago
Phillip Webb 891dd5a0f6 Polish 9 years ago
Stephane Nicoll b569918db1 Add property to disable default health indicators
Add a "management.health.defaults.enabled" property that controls whether
the default health indicators are enabled. This allow to disable them all
by default and still enable individual ones using their respective
specific property.

Closes gh-2298
9 years ago
Stephane Nicoll d3e15805b4 Polish 9 years ago
Dave Syer 6d2af95d59 Allow path with / in JolokiaMvcEndpoint
See gh-3629
9 years ago
Dave Syer ff7717932a Weed out duplicate links if there are 2 endpoints with the same path
Fixes gh-3570
9 years ago
arghya88 6e71af2d21 Fix copyright date
Closes gh-3632
9 years ago
Stephane Nicoll 4a327dc08b Add missing meta-data
Closes gh-3620
9 years ago
Stephane Nicoll a90970060d Polish 9 years ago
Stephane Nicoll e32efc179c Polish 9 years ago
Stephane Nicoll 41bc3b386e Rename ManagementSecurityAutoConfiguration
Since `ManagementSecurityAutoConfiguration` is cnfiguring web-related
things, it has been renamed to `ManagementWebSecurityAutoConfiguration`.

Closes gh-2163
9 years ago
Stephane Nicoll 42e230192f Polish 9 years ago
izeye cb0c6843d2 Remove default paths in HAL and Links endpoints as value varies
The default values of fields in @ConfigurationProperties classes are,
where possible, included in the configuration metadata. The default
values for the HAL and Links endpoints vary depending on other
configuration settings. As a result, including a default in the
metadata is misleading.

This commit removes the default assignment of "" to the path fields so
that no default value will be included in the metadata.

Closes gh-3567
9 years ago
Stephane Nicoll 16dac01886 Polish 9 years ago
Phillip Webb 5d74ea2861 Merge branch '1.2.x' 9 years ago
Phillip Webb d2d71934b6 Polish 9 years ago
Stephane Nicoll 3e26273013 Polish 9 years ago
Stephane Nicoll 43c5151ee1 Merge branch '1.2.x' 9 years ago
Stephane Nicoll 539b009d12 Clean management context path if necessary
Various areas of the code expect the management's context path to not
contain any trailing slash but nothing is enforcing it. We now make sure
to remove any trailing slash, including the one for '/' and make that
explicit via the Javadoc of the getter.

Fixes gh-3553
9 years ago
Phillip Webb 728e64b929 Polish 9 years ago
Andy Wilkinson bedf2edffa Update auto-configuration @Bean methods to return most specific type
Closes gh-2536
Closes gh-2403
9 years ago
Stephane Nicoll f2d32d3e98 Add support for property deprecation
Previously, an item could only have a 'deprecated' boolean flag to
indicate that the property is deprecated. It is desirable to provide an
additional description for the deprecation as well as the name of the
property to use instead.

The `deprecated` boolean flag is now supported. Instead, a `deprecated`
object can be specified with two optional attributes: `reason` to provide
an explanation for the deprecation and `replacement` to refer to the
property that should be used instead. If none of them is present, an
empty deprecation object should be set.

For backward compatibility, the `deprecated` field is still set.

Deprecation information can only set via manual meta-data.

Closes gh-3449
9 years ago
Dave Syer de95012635 Workaround problems with order of endpoint handler mapping
When Spring Data REST is owning the home page it has its own
HandlerMapping with a fix (relatively) low priority. The /links
endpoint wants to own the home page as well, and our handler mapping
has a high priority for good reasons. This change addresses the
issue by checking if Spring Data REST is configured and if
the management context path (or  more specifically, the links
endpoint) is the same as the home page.

Fixes gh-3486
9 years ago
Phillip Webb fd6024ebf1 Move and refactor Redis test server @Rule
Move the Redis JUnit @Rule so that it can be used with
SessionAutoConfigurationTests. Also refactored the internals a little.
9 years ago
Phillip Webb 9ebe15232e Polish 9 years ago
Phillip Webb 6fdcdd888b Merge branch '1.2.x' 9 years ago
Phillip Webb dc18d8d1bb Formatting 9 years ago
Dave Syer e5d3fa0c6c Merge remote-tracking branch '1.2.x' 9 years ago
izeye d06f3b1a25 Fix typo
Closes gh-3473
9 years ago
Dave Syer d0cf6b534b Add 3xx redirects to the "unmapped" class of requests for metrics
When Spring Security sends 302 responses to a login page we don't get
any information about the request matching in Spring MVC. Consequently
apps can end up with a lot of counter.status.302.* metrics (where
"*" can be whatever the user sent).

This change treats 3xx the same as 4xx (if it is unmapped it just gets
added to a metric called "unmapped" instead of using the actual request
path).

Fixes gh-2563
9 years ago
Dave Syer 82da28f627 Add support for custom Exporter with declarative schedule 9 years ago
Andy Wilkinson 58509ed7c5 Merge branch '1.2.x' 9 years ago
Johannes Stelzer fdb83ec338 Correct assertion for indicators parameter in CompositeHealthIndicator
Closes gh-3417
9 years ago
Phillip Webb 67f7079cb2 Formatting 9 years ago
Stephane Nicoll 97634e85ac Remove unnecessary keyword 9 years ago
Phillip Webb 5938c967a3 Polish 9 years ago
Dave Syer 7ceb7ce6f6 Add send count to Integration metrics
Fixed gh-3364
10 years ago
Dave Syer 94e41b4190 Fix assertion in broken test 10 years ago
Dave Syer 7410eee34f Add custom condition for /logfile endpoint
Fixes gh-3360
10 years ago
Dave Syer c71196b92d Better segregation of export and redis keys 10 years ago
Stephane Nicoll 54619bec3f Clarify javadoc
This might just be me but when I read the original javadoc it made me
think that caching worked only if the endpoint is accessed anonymously.
10 years ago
Phillip Webb 7dcb79b3b3 Support more lenient DB2 product lookups
Update DataSourceHealthIndicator to support pattern based matching for
DB2 products. Prior to this commit product identifiers of the form
`DB2/LINUXX8664` were not supported.

Fixes gh-3377
10 years ago
Phillip Webb 85535f0882 Disable DB migrations in ApplicationHierarchyTests 10 years ago
Eddú Meléndez 3995c16ba6 Add 'flyway' and 'liquibase' actuator endpoints
Add `/flyway` and `/liquibase` actuator endpoints to provide details of
any database migrations that have been applied.

Fixes gh-3434
Closes gh-3435
10 years ago
Phillip Webb 7e58483ead Add serialization endpoint tests
Test basic serialization in Endpoint tests to ensure that JSON
can always be produced.
10 years ago
Phillip Webb 9b78f5d52e Replace @ConditionalOnExpression conditions
Replace @ConditionalOnExpression usage in auto-configuration in favor
of faster direct Environment access.
10 years ago
Phillip Webb 71dbec381a Create @ManagementContextConfiguration annotation
Replace the previously used `EndpointWebMvcConfiguration`
`spring.factories` key with a dedicated ManagementContextConfiguration
annotation.

Also renamed the EndpointWebMvcHypermediaConfiguration and
EndpointWebMvcConfiguration classes to make it clearer that they are
for the management context.

See gh-3345
10 years ago