Commit Graph

1387 Commits (7e6097e419eb80e87a38b56c5929e263a7ce8b80)

Author SHA1 Message Date
Andy Wilkinson cff1eea4c4 Make new configuration inner class static
See gh-4079
9 years ago
Alexander Tokarev 91a40dd66c Disable unnecessary database initialization
If a DataSource class is found in the classpath then
EmbeddedDataSourceConfiguration will not be used, so the in-memory
database will not be shutdown on application context closing.
As a result, unnecessary database initialization may cause subsequent
tests to fail, for example see [1].

[1] https://github.com/spring-projects/spring-boot/issues/1712
9 years ago
Andy Wilkinson a4eec42813 Ensure that new JPA-based test doesn’t accidentally enable Bitronix 9 years ago
Andy Wilkinson d01236db30 Fix compile failure that doesn’t occur in Eclipse but does on Travis 9 years ago
Andy Wilkinson fd53cbf2f3 Stop JPA and a custom Flyway bean from causing a startup failure
Previously, if an application used JPA and declared its own Flyway bean,
startup would fail. The custom Flyway bean would switch off
auto-configuration of the FlywayMigrationInitializer bean but the
context’s entity manager factory beans would still be configured to
depend on the migration initialiser.

This commit splits the post-processor that configures the dependencies
into two. One that configures the dependency on the Flyway bean and
one that configures the dependency on the FlywayMigrationInitializer
bean. When to auto-configuration of the FlywayMigrationInitializer is
switched off, the auto-configuration of the latter dependency is also
switched off.

Closes gh-4079
9 years ago
Andy Wilkinson 917077c3dd Merge branch '1.2.x' 9 years ago
Andy Wilkinson a94f3a0cbf Only try to auto-configure Jetty when jetty-webapp is on the classpath
Closes gh-4089
9 years ago
Andy Wilkinson 5c35d89fd1 Revert "Update tests to shut down in-memory databases proactively"
For reasons I don't (yet?) understand, shutting down the databases
proactively triggers a StackOverflowError in Jersey. Reverting the
change while I try to figure out what's going in.
9 years ago
Andy Wilkinson 72122ec965 Update tests to shut down in-memory databases proactively 9 years ago
Phillip Webb d1b936ef2c Merge branch '1.2.x' 9 years ago
Phillip Webb 87a515f6a0 Fix TemplateAvailabilityProvider binding issues
Update all TemplateAvailabilityProvider implementations to use the
relaxed property binder. Also fix FreeMarkerTemplateAvailabilityProvider
to use `template-loader-path` rather than `path`.

Fixes gh-4085
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 5ccd9afc78 Merge branch '1.2.x' 9 years ago
Phillip Webb 891faa9d35 Fix test cleanup to reset commons logging 9 years ago
Andy Wilkinson fac42adb61 Use the right version of ClassUtils 9 years ago
Phillip Webb 2f694fa406 Add per-line match indicators to a/c report
Update the logged auto-configuration report so that each line includes
"matched", "did not match" text. This helps when looking to see if a
specific auto-configuration class was applied or not.

Fixes gh-4084
9 years ago
Andy Wilkinson eae7b0364b Replace use of deprecated JdkVersion API by looking for presence of classes
This commit updates ConditionalOnJava to remove a dependency on the
deprecated JdkVersion API from Spring Framework. In its place it now
looks for the presence of certain classes to determine the version of
Java on which its running.

Closes gh-4005
9 years ago
Phillip Webb c3b7764b72 Polish 9 years ago
Stephane Nicoll 19b5e59234 Use spring.velocity.charset for template encoding
Previously `spring.velocity.charset` only controlled the output encoding
with the templates being loaded with the default encoding. We now
consistently set the same value for both the input and output encodings.

It is still possible to override it to a different value using
`spring.velocity.properties.input.encoding`

Closes gh-3994
9 years ago
Stephane Nicoll 8978f54cc3 Use spring.velocity.charset for template encoding
Previously `spring.velocity.charset` only controlled the output encoding
with the templates being loaded with the default encoding. We now
consistently set the same value for both the input and output encodings.

It is still possible to override it to a different value using
`spring.velocity.properties.input.encoding`

Closes gh-3994
9 years ago
Stephane Nicoll c6040e42a8 Fix typo 9 years ago
Stephane Nicoll b2c3e7e2ed Rename error.* properties to server.error.*
Closes gh-4050
9 years ago
Andy Wilkinson f86eed8646 Polish contribution 9 years ago
mackeprm 942da8bdd3 Support configuration of defaultValue and emptyStringIsFalse
This commit adds support for configuring defaultValue and
emptyStringIsFalse to MustacheCompilerFactoryBean.

Closes gh-4057
9 years ago
Phillip Webb 33ce160251 Automatically X-Forwarded-For in the cloud
Update `ServerProperties` to automatically enable `use-forward-headers`
when running on a cloud platform.

A new `CloudPlatform` enum has been introduced that detects Heroku and
Cloud Foundry.

See gh-4018
9 years ago
Phillip Webb 20b29db512 Unify ServerProperties X-Forwarded-For support
Add a new `server.use-forward-headers` property which can be used to
switch on X-Forwarded-For header support in all supported embedded
servlet containers.

This commit reverts the decision to enable `RemoteIpValve` with Tomcat
by default (gh-3782) and requires that either `user-forward-headers` is
set to true or that `server.tomcat.protocol-header` or
`server.tomcat.remote-ip-header` are set.

See gh-4018
See gh-3782
9 years ago
Phillip Webb 6be072ae07 Polish 9 years ago
Phillip Webb 0b36ba97b3 Polish order 9 years ago
Stephane Nicoll 93d12494e5 Migrate Spring Data Rest settings
In order to have more control on the structure of the configuration, we
do not bind to `RepositoryRestConfiguration` directly anymore. This
commit introduces `RepositoryProperties` instead.

See gh-3854
Closes gh-4073
9 years ago
izeye 5b211706c0 Polish
Closes gh-4069
9 years ago
Phillip Webb acde5407e8 Polish 9 years ago
Stephane Nicoll eeaa1df1dd Allow Mongo support without Spring Data MongoDB
Closes gh-4049
9 years ago
Andy Wilkinson 1e50d988ab Tighten up the conditions on WebSocketMessagingAutoConfiguration
See gh-2445
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
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
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 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
Fabricio Colombo 605eb8a14d Add Liquibase labels and parameters properties
Update `LiquibaseAutoConfiguration` and `LiquibaseProperties` to add
support for labels and parameters.

Closes gh-3915
9 years ago
izeye efb699de60 Remove duplicate `@ConditionalOnMissingBean` checks. 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 a38f01f9e5 Fix compile errors in Eclipse (STS 3.6.4) in UserInfoTokenServicesTests 9 years ago
Phillip Webb 21de97da50 Make jackson-module-parameter-names optional
Update the spring-boot-autoconfigure POM so that
jackson-module-parameter-names is optional.

See gh-3804
9 years ago
Phillip Webb f2ce59c403 Polish 9 years ago