-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Open
Labels
type: documentationA documentation updateA documentation update
Milestone
Description
Description:
Why does Spring Actuator not respect spring.jackson.mapper.default-view-inclusion=true
? This means that if you have @JsonView
, you have to specifically create an if
statement in AbstractMappingJacksonResponseBodyAdvice
that will check the address and, if necessary, not set serializationView
.
Code:
public interface DataView {
interface Basic {
}
}
@RestControllerAdvice
public class SecurityJsonViewControllerAdvice extends AbstractMappingJacksonResponseBodyAdvice {
@Override
protected void beforeBodyWriteInternal(MappingJacksonValue bodyContainer,
MediaType contentType,
MethodParameter returnType,
ServerHttpRequest request, ServerHttpResponse response) {
bodyContainer.setSerializationView(DataView.Basic.class);
}
}
//set in application.properties
//spring.jackson.mapper.default-view-inclusion=true
//#management.endpoint.health.show-details=always
Expected json:
{
"status": "UP",
"groups": [
"readiness"
],
"components": {
...
}
}
What I receive:
{}
Version:
Spring Boot version: 3.5.5
Metadata
Metadata
Assignees
Labels
type: documentationA documentation updateA documentation update