With spring-boot-starter-parent 3.4.0 and springdoc-openapi-starter-webmvc-ui 2.6.0, one solution is to disable generic responses generated by springdoc using the @ControllerAdvice.
You can do this by setting the following property:
springdoc.override-with-generic-response=false
Here is the link to the documentation about this property: springdoc documentation
Where it states:
springdoc.override-with-generic-response | true | Boolean. When true, automatically adds @ControllerAdvice responses to all the generated responses.