This commit makes sure to register the necessary hints to invoke the
main method of any bean available in the context. This is necessary
for tests that use the UseMainMethod feature.
This generates more hints than strictly necessary as there isn't a
way to contribute hints based on a ContextLoader, see
https://github.com/spring-projects/spring-framework/issues/34513 for
more details.
Closes gh-44461
Add `requestFactorySettings` that accepts a `UnaryOperator` so that
the existing `requestFactorySettings` can be customized rather than
replaced.
Closes gh-43258
Update `TestRestTemplate` with a `withRequestFactorySettings` method
that can be used to change defaults such as `Redirects`.
This commit also restores the previous redirect defaults for HTTP
components where redirects would only be followed when the
`HttpClientOption.ENABLE_REDIRECTS` was specified.
Closes gh-43258
Add `redirects(...)` method to `RestTemplateBuilder` to allow redirect
customization. This new method is required in 3.4 since the default
redirect strategy for some clients has changed and users need a way
to restore the old behavior.
See gh-43258
Update `AbstractApplicationContextRunner` and `Configurations` to
allow registration of beans with a specific generated bean name. By
default, no name is generated, however, `AutoConfigurations` has been
updated to use bean names using the fully qualified class name.
The update brings `ApplicationContextRunners` closer the behavior of
a standard Spring Boot application where user `@Configuration` classes
are usually registered with a simple name and auto-configurations are
imported (via an `ImportSelector`) using a fully qualified name.
Fixes gh-17963
Co-authored-by: Stéphane Nicoll <stephane.nicoll@broadcom.com>
Co-authored-by: Andy Wilkinson <andy.wilkinson@broadcom.com>
Co-authored-by: Dmytro Nosan <dimanosan@gmail.com>
This commit reworks the support for enabling and disabling endpoints,
replacing the on/off support that it provided with a finer-grained
access model that supports only allowing read-only access to endpoint
operations in addition to disabling an endpoint (access of none) and
fully enabling it (access of unrestricted).
The following properties are deprecated:
- management.endpoints.enabled-by-default
- management.endpoint.<id>.enabled
Their replacements are:
- management.endpoints.access.default
- management.endpoint.<id>.access
Similarly, the enableByDefault attribute on @Endpoint has been
deprecated with a new defaultAccess attribute replacing it.
Additionally, a new property has been introduced that allows an
operator to control the level of access to Actuator endpoints
that is permitted:
- management.endpoints.access.max-permitted
This property caps any access that may has been configured for
an endpoint. For example, if
management.endpoints.access.max-permitted is set to read-only and
management.endpoint.loggers.access is set to unrestricted, only
read-only access to the loggers endpoint will be allowed.
Closes gh-39046
Update `AssertableApplicationContext` and `ApplicationContextRunner`
implementations to support additional `ApplicationContext` interfaces.
Closes gh-42369
Adds the following new properties:
- spring.application.pid
- spring.application.version
Refactors the ResourceBanner and the structured logging support to use
the new properties.
Closes gh-41604
- Deprecate Deprecate @MockBean and @SpyBean in favor of Spring
Framework 6.2's @MockitoBean and @MockitoSpy
- Migrate usages of @MockBean and @SpyBean to @MockitoBean and
@MockitoSpy
Signed-off-by: Jakob Wanger <jakobwanger@gmail.com>
See gh-39864
This commit updates MockitoTestExecutionListener to not handle mocks
as this is already done in the listener provided by the core framework,
and registration can only happen once.
Integration tests have been left as-is to validate that the presence
of both listeners doesn't have an unwanted side effect.
See gh-41177
Previously, we only looked at the OBJECT_TYPE_ATTRIBUTE on the
factory bean's definition. This did not work for situations
where the information's provided by the definition's target type
rather than the attribute.
Rather than manually considering the target type in addition to
the existing consideration of the attribute, we now ask the bean
factory for the type that will be produced by the factory bean
instead. This should insulate us from any changes and
enhancements in Framework in the future.
Fixes gh-40234