Update `@AutoConfigureMockMvc` with a `printOnlyOnFailure` option which
allows errors to be printed only when tests fail. Defaults to `true`
meaning the logs are no longer cluttered with MVC results for passing
tests.
Fixes gh-6653
Update WebDriver support to ensure that the `.quit()` method is called
after each test method runs and that a new WebDriver instance is
injected each time.
Support is provided by introducing a new `Scope` which is applied by
a ContextCustomizerFactory and reset by a TestExecutionListener.
Fixes gh-6641
Refine @MockBean/@SpyBean qualifier support so that qualifiers form part
of the context cache key. Prior to this commit is was possible that two
different tests could accidentally share the same context if they
defined the same @Mock but with different @Qualifiers.
See gh-6753
Update `@AutoConfigureTestDatabase` so that it always imports
`DataSourceAutoConfiguration`. Prior to this commit the annotation
could only be applied if something else also imported DataSource
auto-configuration.
Fixes gh-6897
Update the launch script so that it no longer changes ownership of the
PID_FOLDER.
Commit b24e736cfe had changed the chown
line from:
chown "$run_user" "$PID_FOLDER/${identity}"
to:
chown "$run_user" "$PID_FOLDER"
This meant that it was possible for the launch script to change
ownership of `/var/run` and prevent later processes from writing to
the folder.
Since PID_FOLDER is created before the chown statement, and that
the `checkPermissions` function runs to ensure that the PID file can
be written, it appears that the chown is not even required.
Fixes gh-6532
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
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
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
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
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
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