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
Previously, if the configured error controller responded with a
redirect to an error caused by an exception, standalone Tomcat would
render its default error page for the original exception. This
occurred because ErrorPageFilter sets the
javax.servlet.error.exception request attribute prior to dispatching
to the error controller and then does not clear it. As the request
unwinds, Tomcat's ErrorReportValve notices that the attribute is set
and renders an error page for the exception that is the attribute's
value.
This commit updates ErrorPageFilter to remove the
javax.servlet.error.exception and javax.servlet.error.exception_type
attributes upon successful completion of a forward to the error
controller. This prevents Tomcat from rendering an error page for
an exception that has already been handled by the error controller.
Closes gh-7920
Previously, SocialWebAutoConfiguration would create a
SpringSocialDialect bean when SpringTemplateEngine was on the
classpath. This class exists in both Thymeleaf 2 and Thymeleaf 3 but
SpringSocialDialect is only compatible with Thymeleaf 2.
This commit updates the auto-configuration to require
SpringResourceResourceResolver to be on the classpath. This class
exists in Thymeleaf 2 but does not exist in Thymeleaf 3.
Closes gh-4858
This commit moves the `spring.pid.*` metadata to the relevant project. It
also updates the doc to refer to the new `ApplicationPidFileWriter`
rather than the one in its deprecatred form.
Closes gh-8196
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
Previously, ManagementContextConfiguration classes were loaded to
allow them to be ordered based on either @Order or implementing
Ordered. This had the unwanted side-effect of possibly logging
unwanted INFO messages if the reflection-based annotation
introspection failed. One cause of this was @ConditionalOnClass when
the referenced class was not on the classpath.
This commit uses the ASM-based annotation metadata reading to
determine the order of a management context configuration class based
on the @Order annotation. The classes are then sorted using a standard
OrderComparator. Note that Ordering via implemented Ordered is not
supported as it cannot be determine without loading the class.
Update all `EmbeddedServletContainer` implementations to ensure that
the `start()` method can be called multiple times, with the second call
being ignored.
Fixes gh-8036
Update `Log4J2LoggingSystem` and `LogbackLoggingSystem` to ensure
that filters are removed when the `cleanUp` method is called. Prior
to this commit application failures would not remove the filter and
no log messages would appear.
The `LoggingApplicationListener` has also been updated since it
previously failed to handle `ApplicationFailureEvents`.
Finally `EventPublishingRunListener` and `DelegatingApplicationListener`
have been updated to deal with `null` parameters and to cope with
listener errors.
Fixes gh-7758
Previously, AbstractEmbeddedServletContainerFactory detected an
exploded war by looking for `/WEB-INF/` in the path of its code
source's location. This failed on Windows due to the use of `\` rather
than `/` separators.
This commit updates AbstractEmbeddedServletContainerFactory to
uses the OS's separator rather than hardcoding `/`.
Closes gh-8100