I am not sure how to design of my Java classes, the question is also related to better testing.
I am using static utility class/method Utils.getMapper()
to get configured ObjectMapper
at many places in my Spring application.
When object mapper is needed, e.g. in @Service
class, should I pass the instance via constructor parameter only or is correct to get mapper in my class by calling utility method?