Commit Graph

1412 Commits

Author SHA1 Message Date
Stephane Nicoll 00af1f5c10 Flag main MbeanExporter `@Primary`
When the actuator is enabled, Spring Boot provides two `MBeanExporter`
bean definitions: a general purpose one and a dedicated one for Actuator
endpoints.

This commit flag the general purpose one `@Primary` so that component
can safely inject it by type if necessary. In particular, this fix the
doc of the `JmxMetricWriter`.

Closes gh-4007
2015-10-12 11:43:16 +02:00
Stephane Nicoll fb4cc718c2 Reuse existing ElasticSearch client
Instead of always creating a new ElasticSearch client, we now check for
the presence of a custom bean configuration and use that if it's
available.

Closes gh-4143
Closes gh-4146
2015-10-12 09:47:48 +02:00
Phillip Webb 877e6e034c Polish 2015-10-09 17:08:28 -07:00
Phillip Webb b6667e8495 Reformat code using Spring code formatter plugin 2015-10-09 13:54:33 -07:00
Phillip Webb 6333426cbf Reformat package-info.java files with Eclipse Mars 2015-10-09 13:54:25 -07:00
Phillip Webb 04074fece1 Merge branch '1.2.x' 2015-10-09 13:39:09 -07:00
Phillip Webb 94736719f1 Reformat package-info.java files with Eclipse Mars 2015-10-09 13:32:57 -07:00
Marten Deinum bad8c1bee8 Added support for the DB2 AS400 Driver
Closes gh-4115
2015-10-09 17:16:21 +02:00
Stephane Nicoll 7971ef24ce Polish
Closes gh-4119
2015-10-09 17:05:06 +02:00
Marten Deinum 96830a550a Add support for the DB2 Universal JDBC driver
Closes gh-4114
2015-10-09 17:03:13 +02:00
Stephane Nicoll 422444c3f2 Add throwExceptionIfNoHandlerFound property
Add a property to customize if an exception should be thrown when no
handler was found to process a given request.

Closes gh-4000
2015-10-09 11:40:46 +02:00
Andy Wilkinson 4968900b1d Gracefully disable Solr auto-configuration when Solr 5 is on classpath
Previously, if Solr 5 was on the classpath, SolrAutoConfiguration
would fail with a rather cryptic error message due to a change in the
inheritance hierarchy of CloudSolrServer between Solr 4 and Solr 5.

This commit updates SolrAutoConfiguration to be conditional on a
class that exists in Solr 4 but was removed in Solr 5. This has the
effect of switching off the auto-configuration when Solr 5 is on
the classpath, allowing the auto-configuration report to be used to
identify why the configuration was disabled. The documentation has
also been updated to state that Spring Boot does not currently support
Solr 5.0.

Closes gh-2795
2015-10-08 16:24:05 +01:00
Andy Wilkinson 031a8d5afa Polishing
Add missing javadoc to AuthoritiesExtractor and
FixedAuthoritiesExtractor
2015-10-08 14:40:52 +01:00
Dave Syer 4768faaba7 Add an AuthoritiesExtractor strategy for UserInfoTokenServices
Default will extract an "authorities" key from the map coming from the
server. No existing servers I am aware of actually send that data, but
it might be helpful as a default nevertheless. User can override the
default by adding a bean of that type.

Fixes gh-3711
2015-10-08 12:13:42 +01:00
Phillip Webb aae38db9af Fix compiler warnings only shown in Eclipse Mars 2015-10-07 23:40:28 -07:00
Phillip Webb c9fb9916b8 Reformat code using Eclipse Mars 2015-10-07 23:37:10 -07:00
Phillip Webb e473364e4e Merge branch '1.2.x' 2015-10-07 23:34:08 -07:00
Phillip Webb 6ab376e2e8 Reformat code use Eclipse Mars 2015-10-07 23:32:31 -07:00
Andy Wilkinson 291955613f Fix compile error in tests that doesn’t affect the compiler in Eclipse 2015-10-07 15:12:26 +01:00
Andy Wilkinson 0cdf19a4cb Update test to align with more precise information about target class
The latest Spring Framework 4.2.2 snapshots have reworked
EventListenerMethodProcessor so that it no longer queries a proxies
target class. Previously, when this was happening, it happened early
in the context's lifecycle when the bean's concrete type was unknown.
The led to the target class being set as the proxied interface.

With the latest 4.2.2 snapshots, the first call to
AopUtils.getTargetClass() happens in the test, by which time the
actual concrete type of the bean is known. This commit updates the
test so that its expectations match the more precise result.
2015-10-07 14:51:45 +01:00
Andy Wilkinson 953ef7091b Remove use of Ordered from auto-configuration classes
Closes gh-4056
2015-10-06 14:44:44 +01:00
Andy Wilkinson bc590a8bf4 Polishing, primarily to keep Checkstyle happy 2015-10-06 11:14:05 +01:00
Andy Wilkinson 2c2c7cee8d Polish contribution
See gh-4082
2015-10-06 09:58:00 +01:00
Benedikt Ritter 6978694cb8 Improve error reporting when driver class version is unsupported
ClassUtils.isPresent(String, ClassLoader) swallows all Throwables when
trying to load a class by name. For this reason
UnsupportedClassVersionError will also be swallowed when user code is
trying to use a driver library which has been compiled with a later
JDK than the one the application is running with. All the user would

see was "Cannot load driver class". This change simply propagates the
UnsupportedClassVersionNumberError so that it is easier for users to
find the root cause of the problem.

Closes gh-4082
Closes gh-4091
2015-10-06 09:58:00 +01:00
Dave Syer e17eab6430 Add placeholder resolution to OnResourceCondition
Users can write @ConditionalOnResource("${path.to.file}") and
placeholders are resolved from the environment.
2015-10-06 09:33:07 +01:00
Andy Wilkinson cff1eea4c4 Make new configuration inner class static
See gh-4079
2015-10-05 14:35:00 +01:00
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
2015-10-05 14:18:39 +01:00
Andy Wilkinson a4eec42813 Ensure that new JPA-based test doesn’t accidentally enable Bitronix 2015-10-05 14:07:01 +01:00
Andy Wilkinson d01236db30 Fix compile failure that doesn’t occur in Eclipse but does on Travis 2015-10-05 13:47:35 +01:00
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
2015-10-05 13:36:20 +01:00
Andy Wilkinson 917077c3dd Merge branch '1.2.x' 2015-10-05 11:41:30 +01:00
Andy Wilkinson a94f3a0cbf Only try to auto-configure Jetty when jetty-webapp is on the classpath
Closes gh-4089
2015-10-05 11:41:23 +01:00
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.
2015-10-05 11:07:47 +01:00
Andy Wilkinson 72122ec965 Update tests to shut down in-memory databases proactively 2015-10-05 10:15:49 +01:00
Phillip Webb d1b936ef2c Merge branch '1.2.x' 2015-10-02 15:44:25 -07:00
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
2015-10-02 15:39:43 -07:00
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
2015-10-02 15:37:39 -07:00
Phillip Webb 5ccd9afc78 Merge branch '1.2.x' 2015-10-02 15:08:25 -07:00
Phillip Webb 891faa9d35 Fix test cleanup to reset commons logging 2015-10-02 15:04:04 -07:00
Andy Wilkinson fac42adb61 Use the right version of ClassUtils 2015-10-02 21:13:52 +01:00
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
2015-10-02 13:09:31 -07:00
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
2015-10-02 19:55:38 +01:00
Phillip Webb c3b7764b72 Polish 2015-10-02 11:25:56 -07:00
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
2015-10-02 16:22:08 +02:00
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
2015-10-02 16:12:42 +02:00
Stephane Nicoll c6040e42a8 Fix typo 2015-10-02 14:06:10 +02:00
Stephane Nicoll b2c3e7e2ed Rename error.* properties to server.error.*
Closes gh-4050
2015-10-02 14:03:24 +02:00
Andy Wilkinson f86eed8646 Polish contribution 2015-10-02 09:03:26 +01:00
mackeprm 942da8bdd3 Support configuration of defaultValue and emptyStringIsFalse
This commit adds support for configuring defaultValue and
emptyStringIsFalse to MustacheCompilerFactoryBean.

Closes gh-4057
2015-10-02 08:57:43 +01:00
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
2015-10-02 00:00:14 -07:00