class CustomAccessTokenResponseHttpMessageConverter extends OAuth2AccessTokenResponseHttpMessageConverter {
    private Converter<OAuth2AccessTokenResponse, Map<String, Object>> accessTokenResponseParametersConverter = new DefaultOAuth2AccessTokenResponseMapConverter();
    private static final ParameterizedTypeReference<Result<Map<String, Object>>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() {};

    private final ObjectMapper objectMapper;
    public CustomAccessTokenResponseHttpMessageConverter(ObjectMapper objectMapper) {
        this.objectMapper = objectMapper;
    }

    @Override
    protected void writeInternal(OAuth2AccessTokenResponse tokenResponse, HttpOutputMessage outputMessage)
            throws HttpMessageNotWritableException {<FILL_FUNCTION_BODY>}
}

        try {
            Map<String, Object> tokenResponseParameters = this.accessTokenResponseParametersConverter.convert(tokenResponse);
            GenericHttpMessageConverter<Object> jsonMessageConverter = new MappingJackson2HttpMessageConverter(objectMapper);
            jsonMessageConverter.write(Result.succeed(tokenResponseParameters), STRING_OBJECT_MAP.getType(), MediaType.APPLICATION_JSON, outputMessage);
        }
        catch (Exception ex) {
            throw new HttpMessageNotWritableException(
                    "An error occurred writing the OAuth 2.0 Access Token Response: " + ex.getMessage(), ex);
        }
    
<methods>public void <init>() ,public final void setAccessTokenResponseConverter(Converter<Map<java.lang.String,java.lang.Object>,org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse>) ,public final void setAccessTokenResponseParametersConverter(Converter<org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse,Map<java.lang.String,java.lang.Object>>) <variables>private static final java.nio.charset.Charset DEFAULT_CHARSET,private static final ParameterizedTypeReference<Map<java.lang.String,java.lang.Object>> STRING_OBJECT_MAP,private Converter<Map<java.lang.String,java.lang.Object>,org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse> accessTokenResponseConverter,private Converter<org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse,Map<java.lang.String,java.lang.Object>> accessTokenResponseParametersConverter,private GenericHttpMessageConverter<java.lang.Object> jsonMessageConverter