Commit Graph

243 Commits

Author SHA1 Message Date
Andy Wilkinson fcd1eb79fc Fix forward merge of new SpyBean test to use correct Mockito 2 API 2017-02-21 20:48:58 +00:00
Andy Wilkinson 1e806bbbd2 Merge branch '1.5.x' 2017-02-21 20:20:36 +00:00
Andy Wilkinson 8318177b0d Merge branch '1.4.x' into 1.5.x 2017-02-21 20:20:26 +00:00
Andy Wilkinson 70e802fba5 Use name from @SpyBean to disambiguate multiple candidates
Previously, @SpyBean's name attribute was not used when determining
the name of the bean to spy upon. When there were multiple candidates,
none of which were primary, this would lead to a failure to find the
bean to spy upon. This behaviour is also inconsistent with @MockBean
which does use the name attribute to identify the bean to mock.

This commit updates MockitoPostProcessor to use the name attribute,
when set, to identify the bean that should be spied upon. For
consistency with @MockBean it is always used when set. When not set
the previous logic will continue to be used.

Closes gh-8315
2017-02-21 20:19:50 +00:00
Andy Wilkinson 13791cad53 Use DefaultUriBuilderFactory instead of DefaultUriTemplateHandler
Closes gh-8247
2017-02-09 14:00:53 +00:00
Brian Clozel 12d883f6b9 Introduce "server.servlet" configuration prefix
This commit refactors the `ServerProperties` property keys and
introduces a separate "server.servlet" namespace to isolate
servlet-specific properties from the rest.

Closes gh-8066
2017-02-07 16:48:22 +01:00
Brian Clozel 250a1601d7 Add WebApplicationType.REACTIVE type
This commit introduces a new variant of web applications: there are now
Servlet based and Reactive web applications.
The mere presence of `Servlet` and `ConfigurableWebApplicationContext`
classes is not enough to make a difference between those variants.
This is why the decision process is now the following:

* if `DispatcherHandler` is present but not `DispatcherServlet`, the
WebApplicationType is detected as REACTIVE
* if `DispatcherHandler` is present and `DispatcherServlet`, this is a
case where we consider that developers are using Spring MVC in
combination with the reactive web client. So WebApplicationType is
detected as SERVLET
* if `Servlet` and `ConfigurableWebApplicationContext` are present,
WebApplicationType is detected as SERVLET
* if none of the above match, WebApplicationType is NONE

Fixes gh-8017
2017-02-06 14:43:16 +01:00
Stephane Nicoll cfdc75d384 Merge branch '1.5.x' 2017-02-06 10:38:16 +01:00
Johnny Lim 0adab8a2be Use logical 'and' instead of bitwise 'and'
Closes gh-8198
2017-02-06 10:35:13 +01:00
Andy Wilkinson aa19cad770 Merge branch '1.5.x' 2017-02-02 13:48:30 +00:00
Andy Wilkinson b9b0cdb342 Merge branch '1.4.x' into 1.5.x 2017-02-02 13:48:19 +00:00
Andy Wilkinson 2f50d515a1 Apply root to URIs directly rather than relying on expansion
Previously, TestRestTemplate applied the root URI to URIs by
converting them to a String and then passing the String to the
RestTemplate delegate. Being a String, meant that the URI passed
through RestTemplate's standard URI template expansion processing
using the configured UriTemplateHandler. While this caused the root
URI to be applied, it also had the unwanted side-effect of
encoding the URI for a second time.

This commit updates TestRestTemplate so that, when configured with a
RootUriTemplateHandler, it applies the root URI directly and then
passes a modified URI to the RestTemplate delegate. Being a URI means
that no template expansion is performed and the possible double
encoding is avoided.

Closes gh-8163
2017-02-02 13:28:52 +00:00
Andy Wilkinson 95f659f4f9 Add new WebApplicationType enum to pave the way for Web Flux support
Closes gh-8077
2017-01-30 20:26:24 +00:00
Spring Buildmaster 5c12500366 Next Development Version 2017-01-30 20:10:13 +00:00
Spring Buildmaster a2696bf873 Next Development Version 2017-01-30 11:40:24 +00:00
Andy Wilkinson 15639d39b0 Merge branch '1.5.x' 2017-01-30 10:02:27 +00:00
Andy Wilkinson dd4051686b Remove empty test
The caching behaviour when using ImportAutoConfiguration is covered
by tests in spring-boot-test-auto-configuration, specifically by
ImportsContextCustomizerFactoryWithAutoConfigurationTests.

See gh-7953
2017-01-30 09:59:11 +00:00
Phillip Webb 8747e039ee Merge branch '1.5.x' 2017-01-27 17:50:01 -08:00
Phillip Webb fa6a138598 Refine ImportsContextCustomizer cache logic
Update `ImportsContextCustomizer` so that whenever possible a more
specific cache key is used.

Prior to this commit the customizer would generate a key based on *all*
annotations on the test class. This has repeatedly caused issues where
test classes that should have the same cache key did not due to
unrelated annotations.

A new `DeterminableImports` interface has been added that can be
implemented by `ImportSelector` and `ImportBeanDefinitionRegistrar`
implementations that are able to determine their imports early. The
existing `ImportAutoConfigurationImportSelector` and
`AutoConfigurationPackages` classes have been retrofitted with
this interface.

Fixes gh-7953
2017-01-27 17:19:52 -08:00
Andy Wilkinson 31b0e81765 Add @FunctionalInterface to remaining public and protected interfaces
See gh-6857
2017-01-27 16:41:09 +00:00
Spring Buildmaster ed1ce140c0 Next Development Version 2017-01-26 14:20:39 +00:00
Stephane Nicoll 661fd848eb Merge branch '1.5.x' 2017-01-25 11:02:32 +01:00
Stephane Nicoll 505e7f75ea Polish contribution
Closes gh-8089
2017-01-25 11:01:53 +01:00
dreis d58f38f6f6 Use String.replace() with single char if possible
See gh-8089
2017-01-25 11:01:52 +01:00
Andy Wilkinson fd677af868 Merge branch '1.5.x' 2017-01-20 16:25:14 +00:00
Andy Wilkinson b71baf2c38 Support @ContextHierarchy when using @SpringBootTest
Closes gh-8000
2017-01-20 16:24:42 +00:00
Andy Wilkinson 973b7a118c Merge branch '1.5.x' 2017-01-19 11:03:38 +00:00
Andy Wilkinson c31a2d8101 Merge branch '1.4.x' into 1.5.x 2017-01-19 11:03:33 +00:00
Andy Wilkinson 80a1e1ae64 Polishing 2017-01-19 11:03:18 +00:00
Andy Wilkinson 84583d2b8f Merge branch '1.5.x' 2017-01-19 10:58:43 +00:00
Andy Wilkinson 4e70cd2934 Merge branch '1.4.x' into 1.5.x 2017-01-19 10:58:34 +00:00
Andy Wilkinson b7a02e7237 Update TestRestTemplate to apply template handler to URIs
Previously, TestRestTemplate would only apply the UriTemplateHandler
to Strings and not to URIs. When using the auto-configured
TestRestTemplate, this prevented relative URIs from being
made absolute using LocalHostUriTemplateHandler.

The commit updates TestRestTemplate to turn URIs into Strings before
passing them to the delegate RestTemplate. Turning them into Strings
ensures that the delegate calls the UriTemplateHandler.

Closes gh-7891
2017-01-19 10:39:02 +00:00
Andy Wilkinson d2201d5284 Correct copyright dates and enforce that starting year is 2012
Closes gh-7923
2017-01-13 18:43:30 -05:00
Phillip Webb 0fca9aaccb Polish Mockito 2.0 support 2017-01-05 16:42:12 -08:00
Phillip Webb 962313d0e1 Merge branch '1.5.x' 2017-01-05 16:30:34 -08:00
Phillip Webb abb8e3663a Polish Mockito 2.0 support 2017-01-05 16:28:59 -08:00
Phillip Webb c4779a10ac Fix Mockito 2 support
See gh-7770
2017-01-05 16:27:41 -08:00
Phillip Webb 77f9bb09ca Further Polish Mockito 2 support
See gh-7770
2017-01-05 14:29:29 -08:00
Phillip Webb 1169f69390 Polish MockitoApi 2017-01-05 14:02:31 -08:00
Phillip Webb 9048c97572 Polish Mockito 2 support
gh-7770
2017-01-05 13:45:40 -08:00
Phillip Webb 0cc313f224 Polish 2017-01-05 11:30:33 -08:00
Stephane Nicoll fab43f343d Merge branch '1.5.x' 2017-01-05 14:22:23 +01:00
Stephane Nicoll 6293033e1b Remove useless dependency 2017-01-05 14:21:59 +01:00
Stephane Nicoll c28ff4314c Upgrade to Mockito 2
Closes gh-7770
2017-01-05 12:22:15 +01:00
Phillip Webb ad2ff27208 Merge branch '1.5.x' 2017-01-05 00:01:08 -08:00
Phillip Webb fac6b8da47 Upgrade to JSONassert 1.4.0
Closes gh-7846
2017-01-05 00:00:07 -08:00
Stephane Nicoll 506f6497c0 Merge branch '1.5.x' 2017-01-04 09:56:19 +01:00
Johnny Lim f915ae197a Polish 2017-01-04 09:53:45 +01:00
Phillip Webb b1cb8bb3d9 Merge branch '1.5.x' 2017-01-03 15:14:41 -08:00
Phillip Webb 8ccd4db513 Merge branch '1.4.x' into 1.5.x 2017-01-03 15:14:14 -08:00