I'm using this class and I'm wondering whether it's thread safe:
The docs don't make any claims about this. I skipped through the code and found no signs it's not thread-safe. It's using an ObjectMapper
internally, which is thread-safe according to docs:
Mapper instances are fully thread-safe provided that ALL configuration of the instance occurs before ANY read or write calls.
So I would assume that Jackson2JsonMessageConverter
is thread-safe, as long as I don't change any configuration before doing any operation.
CodePudding user response:
If you don't change any properties of the Jackson2JsonMessageConverter
at runtime, then it is indeed thread-safe. It is always unpredictable for the next message to convert if new value for properties are going to have effect not. In general most of components in the framework are thread-safe since they are stateless as long as you don't change the component configuration at runtime.