Previously, if a controll endpoint included a mapping with no path,
it would be mapped to the root of the application rather than the
root of the endpoint's path.
This commit updates the handler mappings for both reactive and Servlet
web applications to treat a mapping with no paths as being a mapping
with a single empty path. This ensures that a path with the endpoint's
path prepended is used for the mapping.
Closes gh-12104
Refactor `ConfigurationPropertiesBindingPostProcessor` to allow JSR-303
validation on `@ConfigurationProperties` defined at the `@Bean` method
level.
JSR-303 validation is now applied when a JSR-303 implementation is
available and `@Validated` is present on either the configuration
properties class itself or the `@Bean` method that creates it.
Standard Spring validation is also supported using a validator bean
named `configurationPropertiesValidator`, or by having the configuration
properties implement `Validator`.
The commit also consolidates tests into a single location.
Fixes gh-10803
This commit fixes two issues in `TestRestTemplate`:
* it improves the detection of the underlying request factory, using
reflection to look inside the intercepting request factory if
interceptors were configured
* it avoids reusing the same request factory when creating a new
`TestRestTemplate` with `withBasicAuth`. Sharing the same instance would
result in sharing authentication state (HTTP cookies). Since the
original request factory can't be detected consistently, a new one is
selected automatically
See gh-8697
Previously `TestRestTemplate` would override the configured
`ClientHttpRequestFactory` if the Apache HTTP client library was on
classpath.
This commit fixes two issues:
1. The existing `ClientHttpRequestFactory` is overridden *only* if it is
using the Apache HTTP client variant, in order to wrap it with the
`TestRestTemplate` custom support
2. Calling `withBasicAuth` will no longer directly use the request
factory returned by the internal `RestTemplate`; if client interceptors
are configured, the request factory is wrapped with an
`InterceptingClientHttpRequestFactory`. If we don't unwrap it,
interceptors are copied/applied twice in the newly created
`TestRestTemplate` instance. For that, we need to use reflection as the
underlying request factory is not accessible directly.
Closes gh-8697
The `server.display-name` configuration property is used to configure
the application display name for Servlet-based applications.
This commit moves that property to:
`server.servlet.application-display-name` and keeps the same defaults.
Closes gh-8624
Previously, we removed the Connectors from Tomcat's Service before
the Context was started. The removal of the Connectors is required as
it prevents Tomcat from accepting requests before we're ready to
handle them.
Part of starting the Context is creating and initializing the
ServletContext. ServerProperties uses a ServletContextInitializer to
set the session tracking modes and Tomcat rejects the SSL tracking
mode if there is no SSL-enabled connector available. With the previous
arrangement this led to a failure as the Connectors had been removed
so the SSL-enabled connector could not be found.
This commit updates the embedded Tomcat container to defer the
removal of the Connectors until after the context has been started
but still at a point that is before the Connectors themselves would
have been started.
Closes gh-12058