Commit Graph

1349 Commits

Author SHA1 Message Date
Phillip Webb 57a698f388 Fix broken Cassandra tests
See gh-2064
2015-09-25 23:59:00 -07:00
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
2015-09-25 23:00:53 -07:00
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
2015-09-24 20:44:10 +01:00
Phillip Webb 028fc04777 Fix checkstyle errors 2015-09-24 10:57:58 -07:00
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
2015-09-24 10:45:00 -07:00
Phillip Webb 764c0a8bf9 Make FlywayMigrationInitializer ordered and public
Update `FlywayAutoConfiguration` to allow explicit ordering of the
`FlywayMigrationInitializer`.

Fixes gh-4011
2015-09-24 10:35:12 -07:00
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
2015-09-24 10:24:08 -07:00
Fabricio Colombo 605eb8a14d Add Liquibase labels and parameters properties
Update `LiquibaseAutoConfiguration` and `LiquibaseProperties` to add
support for labels and parameters.

Closes gh-3915
2015-09-23 23:56:51 -07:00
izeye efb699de60 Remove duplicate `@ConditionalOnMissingBean` checks. 2015-09-23 21:30:47 -07:00
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
2015-09-22 11:52:23 -07:00
Andy Wilkinson a38f01f9e5 Fix compile errors in Eclipse (STS 3.6.4) in UserInfoTokenServicesTests 2015-09-22 12:54:39 +01:00
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
2015-09-21 16:45:35 -07:00
Phillip Webb f2ce59c403 Polish 2015-09-21 15:04:22 -07:00
Phillip Webb 86daf44435 Add @Since tag 2015-09-21 14:43:41 -07:00
Andy Wilkinson 7f2be6ce27 Add auto-configuration for Jackson's parameter names module
The parameter names module allows users of Java 8 that have compiled
their code with the -parameters option to avoid the name for
annotations to map the json onto constructor and method parameters
with the names of the parameters being used instead.

This commit adds auto-configuration for the module that will only
be enabled when running on Java 8.

Closes gh-3804
2015-09-21 17:06:06 +01:00
Andy Wilkinson c3e447c84c Order char encoding filter so it sets encoding before request is read
For the character encoding filter to work, it's vital that it sets
the request's encoding before any other filters attempt to read the
request. This commit updates the order of
OrderedCharacterEncodingFilter to be HIGHEST_PRECEDENCE and improves
the existing test to check that the ordering is as required.

Closes gh-3912
2015-09-21 15:32:53 +01:00
Andy Wilkinson c274162e6f Correct since version in javadoc of Any and AllNestedCondition 2015-09-15 16:43:11 -04:00
Andy Wilkinson a9d67213be Override Eclipse’s formatting to keep Checkstyle happy
See gh-3964
2015-09-15 07:15:02 -04:00
Andy Wilkinson 2fd8a58197 Polish contribution
- Rename local variable to avoid shadowing field with the same name
 - Add a test to verify that local.mongo.port is set on the parent
   context

Closes gh-3955
2015-09-15 06:58:53 -04:00
Paweł Doleciński 8f5a753eff Fix propagation of local.mongo.port up the context hierarchy
Previously, a StackOverflowError would occur when using a random port
for embedded mongo as the logic for propagating the property up the
context hierarchy would repeatedly use the leaf context's parent.

This commit updates the logic to look to see if the current context
has a parent, only calling the method again if it does.

Closes gh-3956
2015-09-15 06:56:11 -04:00
Andy Wilkinson b79ca614a1 Replace usage of deprecated API in EmbeddedMongoAutoConfiguration 2015-09-15 06:41:15 -04:00
Phillip Webb 6746a0af7b Merge branch '1.2.x' 2015-09-10 15:02:20 -07:00
Pei-Tang Huang a5430d8a0c Catch more general Hibernate 4.2 LinkageError
Update HibernateJpaAutoConfiguration to catch LinkageError rather than
NoClassDefFoundError. Required due to the fact that JBoss EAP 6 wraps
NoClassDefFoundErrors.

Fixes gh-3605
2015-09-10 14:58:26 -07:00
Phillip Webb b7e9f805c9 Set ignoreUnknownFields=true on ServerProperties
Update ServerProperties so that unknown SERVER_* environment properties
do not cause startup failures.

Fixes gh-3903
2015-09-10 14:49:41 -07:00
Phillip Webb e674d751de Polish Javadoc 2015-09-08 17:01:36 -07:00
Phillip Webb e07df7e4c6 Remove redundant modifiers 2015-09-08 17:01:30 -07:00
Phillip Webb 460ca75fce Polish newline at end of file 2015-09-08 16:05:22 -07:00
Phillip Webb d09805fd75 Polish license headers 2015-09-08 16:05:05 -07:00
Phillip Webb 6e29ee4557 Polish 2015-09-08 16:04:30 -07:00
Phillip Webb 67402405db Reformat code 2015-09-08 14:56:40 -07:00
Phillip Webb 2615990ffb Organize imports 2015-09-08 14:40:35 -07:00
Phillip Webb 0335053139 Merge branch '1.2.x' 2015-09-08 14:37:16 -07:00
Phillip Webb 15686ed4fd Reformat code 2015-09-08 14:07:06 -07:00
Phillip Webb 0f6b60d8c8 Organize imports 2015-09-08 14:05:00 -07:00
Phillip Webb 690da89c82 Fix warnings 2015-09-05 00:21:09 -07:00
Phillip Webb 4aa2fed48b Revert "configure JRE that is different from compiler target level"
This reverts commit 678f36cfef.
2015-09-02 23:44:27 -07:00
Phillip Webb 6193b640a4 Polish 2015-09-02 23:44:19 -07:00
Phillip Webb db41fb16c0 Polish Hazelcast auto-configuration
Extract a HazelcastInstanceFactory class and cleanup some formatting.

See gh-2942
2015-09-02 23:44:00 -07:00
Phillip Webb 138d66706a Polish nested conditions 2015-09-02 23:44:00 -07:00
Stephane Nicoll fa099ff8df Polish 2015-09-02 17:12:20 +02:00
Stephane Nicoll 1a60056f9e Polish contribution
Closes gh-3831
2015-09-02 16:54:15 +02:00
james 560ffc9056 Do not attempt to restart non-restartable jobs
Closes gh-3830
2015-09-02 16:53:37 +02:00
Stephane Nicoll cd1ace0c15 Merge branch '1.2.x' 2015-09-02 16:46:41 +02:00
Barry Lagerweij 8d75aa0ea9 Fix Oracle XA datasource class name
Closes gh-3846
2015-09-02 16:44:29 +02:00
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
2015-09-02 12:02:35 +02:00
Dave Syer 2b3d419e10 Add FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER constant
All the filters added explicitly by Spring Boot now have order <=
FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER (value 0).
There is nothing we can do about the DispatcherServlet and anything
else downstream of the filter chain.

Fixes gh-3613
2015-09-01 18:27:01 +01:00
Andy Wilkinson be640965a6 Support resolution of HAL link titles from a resource bundle
Spring HATEOAS 0.19.0.RELEASE provide support for resolving a link’s
title by looking up the key _links.$rel.title. For us to take advantage
of this in Spring Boot, HalHandlerInstantiator must be created using
the link relation message source that’s automatically created by
HateoasConfiguration.

Closes gh-3860
2015-09-01 15:20:36 +01:00
Stephane Nicoll bd942a35fb Fix upgrade to Spring Data Gosling RELEASE
Closes gh-3860
2015-09-01 15:11:01 +02:00
Andy Wilkinson bb92387928 Polishing 2015-08-27 17:42:02 +01:00
Rob Winch 34772e4177 Add Auto Configuration for SecurityEvaluationContextExtension
Fixes gh-3840
2015-08-27 11:11:38 -05:00