Commit Graph

9026 Commits

Author SHA1 Message Date
Phillip Webb 3172d434a7 Polish
Closes gh-6835
2016-09-16 13:31:54 -07:00
Andy Wilkinson 49f28b7941 Merge branch '1.3.x 2016-09-16 19:29:06 +01:00
Andy Wilkinson faab9047d6 Start building against Spring Framework 4.2.8 snapshots
See gh-6910
2016-09-16 19:25:51 +01:00
Stephane Nicoll b77eddb8bb Merge branch '1.3.x' 2016-09-16 16:58:53 +02:00
Stephane Nicoll c2cdc1424b Polish documentation
Add an explicit note that states that "spring.datasource.url" (or more
specifically "spring.datasource.class-name" that is inferred from the
former) is necessary to connect to a database. If the class-name isn't
specified, Spring Boot will attempt to auto-configure an embedded
database.

Closes gh-6907
2016-09-16 16:58:39 +02:00
Stephane Nicoll 50c68a497b Improve startup error message
This commit improves the startup error message so that it does not
reference  `--debug` anymore. Such command-line switch only works when
the application is started using `java -jar`.

The error message now refers directly to a section of the documentation
that provides more details and links to more useful examples.

Closes gh-6593
2016-09-16 16:37:50 +02:00
Stephane Nicoll 78bb04f2c1 Polish 2016-09-16 14:54:11 +02:00
Stephane Nicoll 284988f0cd Clarify SpringBootWebSecurityConfiguration scope
This commit fixes the documentation that wrongly states that
SpringBootWebSecurityConfiguration is an auto-configuration. Rather than
excluding this class, we should exclude SecurityAutoConfiguration that
imports it.

Closes gh-6861
2016-09-16 14:53:50 +02:00
Stephane Nicoll 3f236dc951 Support Qualifiers on MockBean and SpyBean
Previously, if an injection point used a qualifier, `MockBean` and
`SpyBean` couldn't be used to mock/spy it as there was no way to
specify that qualifier information.

This commit now detects qualifier information on the injection point
and associate it with the created `BeanDefintion`. If one wants to
mock a bean that is qualified with `@Qualifier("foo")`, the definition
of the mock should be as follows:

```
public class MyTest {

	@MockBean
	@Qualifier("foo")
	private ExampleService service;
}
```

As a side effect, it is now possible to mock a service by type even if
there are multiple instances of that type in the application context. The
provided qualifier information is used to determine the right candidate
and the proper bean definition is replaced accordingly.

Closes gh-6753
2016-09-16 11:17:23 +02:00
Phillip Webb 3e19f8aa8d Relax TestEntityManager @ID restriction
Change TestEntityManager so that entities with an ID can be persisted.

Fixes gh-6546
2016-09-15 17:22:52 -07:00
Phillip Webb 25c4e261e9 Fix failing tests
See gh-6897
2016-09-15 17:16:26 -07:00
Phillip Webb 5f7897ba41 Refine inner-class test @Configuration detection
Update detection logic to also consider `@Rules` classes. Also make the
documentation a little clearer.

Fixes gh-6768
2016-09-15 16:55:49 -07:00
Phillip Webb 46815fc483 Fix potential @AutoConfigureTestDatabase NPE
Protect against the situation where no DataSource beans can be found
at all.

Fixes gh-6897
2016-09-15 16:06:56 -07:00
Phillip Webb fe7bbbe8ee Merge pull request #6882 from olivergierke/issue/6881
* pr/6882:
  Use default simple types with MongoMappingContext
2016-09-15 10:55:27 -07:00
Oliver Gierke 0860ad4fd4 Use default simple types with MongoMappingContext
Change the auto-configure MongoMappingContext to use the
SimpleTypesHolder instance `Set` that's produced by a CustomConversions
bean, which we in turn now default, too.

This update is necessary as `CustomConversions` registers converters by
inspecting the classpath (to automatically detect Java 8, JodaTime etc.)
and by that rendering the types for which we find converters for as
simple ones, i.e. non-entities.

Fixes gh-6881
Closes gh-6882
2016-09-15 10:42:59 -07:00
Phillip Webb f38deadab9 Merge pull request #6891 from kazuki43zoo/externalized-configuration-in-doc
* pr/6891:
  Document devtools properties in config load order
2016-09-15 10:30:28 -07:00
Kazuki Shimizu 2cedb45c68 Document devtools properties in config load order
Add reference to `~/spring-boot-devtools.properties` in
"Externalized Configuration" section.

Closes gh-6891
2016-09-15 10:28:45 -07:00
Phillip Webb ebb08c3655 Generate property meta-data for test projects
Add annotation processor to `spring-boot-test` and
`spring-boot-test-autoconfigure`.

Fixes gh-6893
2016-09-15 10:14:21 -07:00
Andy Wilkinson 045f357147 Upgrade Elasticsearch to 2.4 and restore use of Jackson 2.8
In 1.4.0 we used Elasticsearch 2.3.5 and Jackson 2.8. This
combination was incompatible in some circumstances due to a change
in Jackson (gh-6508). With Elasticsearch 2.4 yet to be released at the
time, the only way to restore compatibility was to downgrade Jackson.

With the release of Elasticsearch 2.4 we have another option: revert
the Jackson downgrade and upgrade Elasticsearch instead. While we
normally wouldn't consider upgrading to a new minor version of a
dependency in a maintenance release we have to do something to restore
compatibility. The alternative is to downgrade Jackson but that will
affect more people (Jackson is more widely used than Elasticsearch)
and will lose some functionality that was new in Jackson 2.8 that
people may already be relying upon.

This commit restores the use of Jackson 2.8 – including the
2.8-specific dependency management – and upgrades to Elasticsearch 2.4

Closes gh-6868
2016-09-15 15:41:50 +01:00
Andy Wilkinson 28ea6fd38a Fix LegacyCookieProcessor configuration example and test it
Closes gh-6827
2016-09-15 14:53:14 +01:00
Andy Wilkinson 5c632dfc8b Merge branch '1.3.x 2016-09-15 14:06:11 +01:00
Andy Wilkinson 30cb15a0d5 Update docs to note that Gradle 3 is not supported
Breaking API changes in Gradle 3.0 make it impossible to support
it reliably alongside Gradle 1 and 2 without mainintaining multiple
versions of our Gradle plugin. This commit updates the documentation
to note that Gradle 3 is not supported.

Closes gh-6880
2016-09-15 14:01:53 +01:00
Andy Wilkinson 4d2e557fdf Merge branch '1.3.x 2016-09-15 13:35:52 +01:00
Andy Wilkinson b8833c40b6 Allow spring.config.location to be configured via servlet context
Previously, in a war deployment, the web environment’s property sources
were initialized using the servlet context after the application’s
configuration had been read by ConfigFileApplicationListener. This
meant that spring.config.location configured via the servlet context
had no effect.

This commit adds a new ApplicationListener,
ServletContextApplicationListener, that initialises the configurable
web environment’s property sources using the servlet context. It’s
ordered with higher precedence than ConfigFileApplicationListener to
ensure that any properties defined in the servlet context are available
when loading the application’s configuration.

Closes gh-6801
2016-09-15 13:28:23 +01:00
Andy Wilkinson 56cf49665f Add some tests for ServletContextApplicationContextInitializer 2016-09-15 13:14:02 +01:00
Stephane Nicoll 7e263d899f Polish cache doc
Closes gh-6892
2016-09-15 13:44:05 +02:00
Andy Wilkinson 7b3382e332 Fail fast if @WebAppConfiguration is used with a non-mock web environement
@WebAppConfiguration expects a mock web environment. If it is used
in conjuction with @SpringBootTest configured with a RANDOM_PORT or
DEFINED_PORT web environment a null pointer exception occurs as an
assumption that's made by MockServerContainerContextCustomizer doesn't
hold true in a non-mock web environment.

This commit updates SpringBootTestContextBootstrap to detect the
illegal configuration combination and fail fast, advising the user
to remove @WebAppConfiguration or reconfigure @SpringBootTest.

Closes gh-6795
2016-09-15 11:16:42 +01:00
Stephane Nicoll 8470ecb4d0 Polish 2016-09-15 09:37:23 +02:00
Phillip Webb 7134586310 Ensure test @PostConstructs are only called once
Rename AutoConfigureReportTestExecutionListener to
SpringBootDependencyInjectionTestExecutionListener and ensure that it
replaces any existing DependencyInjectionTestExecutionListener.

Prior to this commit the registration of two DependencyInjection
listeners would cause @PostConstruct methods on tests to be called
twice.

In order to allow the standard DependencyInjectionTestExecutionListener
to be removed a new DefaultTestExecutionListenersPostProcessor interface
has been introduced.

Fixes gh-6874
2016-09-14 22:03:07 -07:00
Phillip Webb 3d89dabb4b Document how to use LegacyCookieProcessor
Closes gh-6827
2016-09-14 20:18:49 -07:00
Phillip Webb 0606428609 Allow default profile to also be set in properties
Update `ConfigFileApplicationListener` so that active profiles set in
properties files that overlap with `spring.profiles.default` can still
be set.

Prior to this commit if `spring.profiles.active` happened to specify
a profile name that was also in `spring.profiles.default` it would
not get applied.

Fixes gh-6833
2016-09-14 17:49:59 -07:00
Phillip Webb dcfe2673fd Fix failing test following Tomcat upgrade
Tomcat 8.5.5 has change the default value of `validationInterval` to
3000. See https://bz.apache.org/bugzilla/show_bug.cgi?id=59923 for
details.

See gh-6703
See gh-6657
2016-09-14 17:14:37 -07:00
Stephane Nicoll 5d3ac53da9 Polish
See gh-6870
2016-09-14 16:34:01 +02:00
Andy Wilkinson 21a25ce855 Revert "Fail fast if @WebAppConfiguration and @SpringBootTest are used together"
This reverts commit c54cdd6735.
2016-09-14 15:04:34 +01:00
Andy Wilkinson a68cf77386 Upgrade to Tomcat 8.5.5
As part of the upgrade, Tomcat now requires a keystore to contain
an X.509 certificate. The two stores used in our tests have been
updated by exporting their private keys and adding them as
certificates. For example:

$ keytool -exportcert -keystore test.jks -alias tomcat > exported
$ keytool -importcert -keystore test.jks -file exported

Closes gh-6703
Closes gh-6657
2016-09-14 14:59:53 +01:00
Andy Wilkinson c54cdd6735 Fail fast if @WebAppConfiguration and @SpringBootTest are used together
Closes gh-6795
2016-09-14 14:59:32 +01:00
Stephane Nicoll 878a052567 Add reference to `SpringBootTest#properties`
Closes gh-6870
2016-09-14 14:16:12 +02:00
Stephane Nicoll c65f099b9a Merge pull request #6872 from izeye:polish-20160913
* pr/6872:
  Polish
2016-09-13 09:25:25 +02:00
Johnny Lim caa4c0800f Polish
Closes gh-6872
2016-09-13 09:25:06 +02:00
Phillip Webb 3684c2ec56 Ensure argument matchers work with AOP spies
Update MockitoAopProxyTargetInterceptor to deal with deal with any
existing argument matchers when working with the VerificationMode.

Prior to this commit `@SpyBean` when combined with AOP could not support
argument matchers.

Fixes gh-6871
2016-09-12 14:53:07 -07:00
Phillip Webb 41a36c4d40 Prevent CastCastException when stripping root URI
Update RootUriRequestExpectationManager to only wrap requests when
they cannot be cast to MockClientHttpRequest. This prevents later
ClassCastExceptions from being thrown with @RestClientTests that
define expected body content.

Fixes gh-6845
2016-09-12 12:44:31 -07:00
Phillip Webb c56f30fd91 Formatting 2016-09-12 12:44:31 -07:00
Stephane Nicoll c662986628 Merge branch '1.3.x' 2016-09-12 16:30:25 +02:00
Stephane Nicoll 6eb0449aa9 Use BDD mockito
See gh-6869
2016-09-12 16:30:07 +02:00
Stephane Nicoll d87d60f746 Merge branch '1.3.x' 2016-09-12 16:02:28 +02:00
Stephane Nicoll b88cb35ea2 Fix JMS health indicator
This commit improves the JMS health indicator to identify a broken broker
that uses failover. An attempt to start the connection is a good way to
make sure that it is effectively available.

Closes gh-6818
2016-09-12 15:59:18 +02:00
Stephane Nicoll 5b0d916910 Merge pull request #6651 from vpavic:improve-batch-autoconfig
* pr/6651:
  Polish contribution
  Validate Spring Batch database initializer configuration
2016-09-12 14:53:27 +02:00
Stephane Nicoll ee668e6782 Polish contribution
Closes gh-6651
2016-09-12 14:53:02 +02:00
Vedran Pavic 06a1f44128 Validate Spring Batch database initializer configuration
This commit adds Spring Batch configuration validation that disables
database initializer in case custom table prefix is configured with
default schema.

See gh-6651
2016-09-12 14:42:07 +02:00
Stephane Nicoll def40bf27f Polish 2016-09-12 14:36:12 +02:00