I have no idea what is happening, but on further testing it seems to be suddenly working.
Seems to be working after a Wildfly restart. No code changes or any changes to my JSON Formatter.
Does the MDC persist across deployments?
It seems like I have to restart the whole Wildfly to be able to remove entries in the MDC.
I added a MDC.put("test", "hello world") directly in my resource endpoint, saw that it appeared in my JSON, removed it and redeployed, still got the {"test": "hello world"} in my JSON.
Added MDC.clear() to my ContainerResponseFilter, but still got {"test": "hello world"} in my JSON. After restarting Wildfly it disappeared.
I thought the MDC was thread-safe, how can it reuse MDC values from a previously deployed artifact if it is thread-safe?