Skip to content

Commit

Permalink
instantiate lazily to avoid errors during startup
Browse files Browse the repository at this point in the history
  • Loading branch information
burtbeckwith committed Aug 21, 2024
1 parent c4cb3ea commit c4fb08e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
@Internal
public class AzureJsonFormatter implements JsonFormatter {

private final ObjectMapper objectMapper = ObjectMapper.getDefault();
private ObjectMapper objectMapper;

@Override
public String toJsonString(Map map) throws IOException {
if (objectMapper == null) {
objectMapper = ObjectMapper.getDefault();
}
return objectMapper.writeValueAsString(map);
}
}

0 comments on commit c4fb08e

Please sign in to comment.