See https://github.com/spring-projects/spring-boot/issues/7439.

@MockitoBean-based integration test can be used to validate this case.