Commit Graph

5895 Commits (4ccbca259bf82c6e12d89158444be6159800be3e)
 

Author SHA1 Message Date
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 1f4dc77715 Improve error message when a non-directory is added to FileSystemWatcher
Previously, if a file or non-existent directory was added to
FileSystemWatcher, it would fail with the message “Folder must not be a
file”. While it suggests that the folder needs to be a directory, it
doesn’t make it clear that it also needs to exist. It also doesn’t
tell the user which folder caused the problem.

This commit updates the message to make it clear that the folder must
exist and must be a directory, and the include the name of the
problematic folder in the error message.

Closes gh-3918
9 years ago
Andy Wilkinson 968caf05b6 Merge branch 'gh-3977' 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
Andy Wilkinson a76e84addc Restore LoggingSystems’ previous cleanup behaviour
This commit reverts the changes made for gh-4026. Those changes updated
each LoggingSystem to close/stop the underlying logging system as part
of the clean up processing. Unfortunately, this approach doesn’t work
in an environment where their are multiple application contexts and
some have a shorter lifecycle than the “main” application context. In
such an environment, closing an application context with a shorter
lifecycle prior to the main application context being closed will
close/stop the main application context’s logging system as, rather than
being scoped to an application context, a logging system is shared
across multiple application contexts. (The exact details of how widely
shared the logging system is varies between logging systems and, in the
case of Logback and Log4J2, also depends on which ContextSelector
implementation is being used.
9 years ago
Stephane Nicoll e98aac4327 Polish d01bc41
Closes gh-2516
9 years ago
Stephane Nicoll 8a8c8272d2 Merge pull request #4054 from zhanhb/patch-2
* pr/4054:
  Fix typo
9 years ago
zhanhb b855a68bf4 Fix typo
Closes gh-4054
9 years ago
Phillip Webb 9681df0e9f Merge branch '1.2.x' 9 years ago
Phillip Webb 69d57f9a35 Polish 9 years ago
Phillip Webb b0d9a8322e Support `.` and `_` binder prefix joins
Update RelaxedDataBinder so that both `.` and `_` are considered in
getPropertyValuesForNamePrefix(...).

With Spring Boot 1.2.5 binding environment variables of the form
`FOO_BAR_BAZ` to `@ConfigurationProperties(prefix="foo-bar")` objects
worked thanks to a happy accident. When `PropertySourcesPropertyValues`
processed a non enumerable `PropertySource` it called the resolver
with a property name `FOO_BAR.BAZ`. A `SystemEnvironmentPropertySource`
will replace `.` with `_` and hence find a value.

Commit 1abd0879 updated non enumerable processing such that the resolver
was never called.

Replicating the problem is quite involved as you need to ensure that you
have both a SystemEnvironmentPropertySource and a non-enumerable
property source (e.g. RandomPropertySource). A test has been added to
PropertiesConfigurationFactoryTests which passes on 1.2.5, fails on
1.2.6 and passes again following this commit.

Fixes gh-4045
9 years ago
Andy Wilkinson e9878ebb5d Update tests to close the application contexts that they create
This commit updates a number of tests in spring-boot to ensure that
they close the application contexts that they create. SimpleMainTests
still create a number of contexts that are not closed as there’s no
(easy) way to get hold of the context when testing the main method.

See gh-4053
9 years ago
Andy Wilkinson 1bc1785db7 Return Logback to its default basic configuration after clean up
See gh-4026
9 years ago
Andy Wilkinson f7e8e1554c Shut down logging system as part of clean up processing
Previously, when a LoggingSystem was cleaned up the underlying logging
system (LogBack, Log4J, Log4J2, JUL) was not being properly shut down.
LogBack explicitly recommends stopping it cleanly [1]. While the other
logging systems are less explicity about it, they would all appear to
benefit from being stopped.

This commit updates all four LoggingSystems to stop/reset/clean up to
underlying logging system when cleanUp is called.

Closes gh-4026

[1] http://logback.qos.ch/manual/configuration.html#stopContext
9 years ago
Andy Wilkinson 1e50d988ab Tighten up the conditions on WebSocketMessagingAutoConfiguration
See gh-2445
9 years ago
Phillip Webb fa040c9e26 Fix tests failing on Windows 9 years ago
Andy Wilkinson 204cb6f195 Auto-configure WebSocket JSON converter to use context’s ObjectMapper
This commit adds auto-configuration support for WebSocket-based
messaging. When the user enables WebSocket messaging (typically via
@EnableWebSocket and @EnableWebSocketMessageBroker) and an ObjectMapper
bean exists, a MappingJackson2MessageConverter that uses the
ObjectMapper will be configured. This causes any spring.jackson.*
configuration to affect WebSocket message conversion in the same way
as it affects HTTP message conversion.

Closes gh-2445
9 years ago
Andy Wilkinson 2440e05cc4 Document startup script's support for JAVA_OPTS
Closes gh-3808
9 years ago
Andy Wilkinson d357533105 Upgrade to Undertow 1.3.0.CR2
The code that uses reflection to determine the protocol and port has
been updated to align with changes made in Undertow 1.3

See gh-3969
9 years ago
Andy Wilkinson a23d11fe6c Update appendix with details of new Spring HATEOAS property
Follow-on from c55900b4.

Closes gh-3891
9 years ago
Andy Wilkinson 727fc23381 Upgrade to Undertow 1.3.0.CR2
See gh-3969
9 years ago
Phillip Webb eadfa109d5 Improve classpath resource not supported message
Update TomcatEmbeddedServletContainerFactory to provide a better error
message when attempting to load classpath resources.

Fixes gh-2635
9 years ago
Phillip Webb d01bc41e1e Detect XML config files and Groovy test scripts
Update SpringApplicationContextLoader to detect xml and groovy
configuration based on convention.

Fixes gh-2516
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 49583c0aa3 Limit spring.factories in RemoteSpringApplication
Update RemoteSpringApplication so that initializers and listeners are
prescribed and not loaded from spring.factories.

Fixes gh-3925
9 years ago
Phillip Webb 4bdfb1af85 Merge pull request #2371 from Stummi/stacktraceproperties
* gh-2371:
  Support `error.include-stacktrace` configuration
9 years ago
Michael Stummvoll a1e0f01103 Support `error.include-stacktrace` configuration
Add `error.include-stacktrace` configuration option to determine when
stack trace attributes should be added. Options are `never`, `always`
or `on-trace-param`.

Prior to this commit stacktrace attributes were never includes in HTML
responses, and only included in JSON responses when a `trace` request
parameter was set to `true`. This has now been changed so that,
by default, stacktrace attributes are never included.

The BasicErrorController includes a protected method that can be
overridden if includes should be different depending on the `produces`
mapping.

Closes gh-2371
9 years ago
Stephane Nicoll f918bf9c11 Fix broken build 9 years ago
Dave Syer 2e3658fd91 Enable RemoteIpValve by default
Fixes gh-3782
9 years ago
Dave Syer c8ec2cb70b Add missing annotation to openTSDB sample 9 years ago
Phillip Webb c73ffdd5a6 Fix javadoc import issues 9 years ago
Phillip Webb 31f0c837fd Fix broken Cassandra sample tests
See gh-2064
9 years ago
Phillip Webb 2aeb88a2ba Upgrade to Spring Framework 4.2.2.BUILD-SNAPSHOT
Use SNAPSHOT build in preparation for 4.2.2.

See gh-4020
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
Phillip Webb e39d571bff Merge pull request #2214 from jdubois/master
* gh-2214:
  Add Cassandra support
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
Phillip Webb 49fab4a60f Fix broken documentation link 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 028fc04777 Fix checkstyle errors 9 years ago
Phillip Webb b95bb54e8c Make BasicErrorController easier to subclass
Extract a new AbstractErrorController base class for users to extend
if they don't like the default BasicErrorController.

Fixes gh-3998
9 years ago
Phillip Webb 764c0a8bf9 Make FlywayMigrationInitializer ordered and public
Update `FlywayAutoConfiguration` to allow explicit ordering of the
`FlywayMigrationInitializer`.

Fixes gh-4011
9 years ago
Phillip Webb 06f3202c68 Improve DataSourceProperties exception messages
Update DataSourceProperties exceptions to include a less misleading
message. Errors message now note that you may need to add an embedded
database to the classpath or active a profile to pickup specific
settings.

Fixes gh-4012
9 years ago
Phillip Webb 44c122307e Tweak port usage to try and fix Windows CI build 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
Phillip Webb bf34dc5013 Merge pull request #3719 from sbuettner/master
* pr/3719:
  Add statsd metric export auto-configuration
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