The current spring-boot-starter-json
is a bit weird for two reasons:
spring-boot-starter
) so if you only bring that, the app doesn't even compile. All others starters bring the base starter AFAIKJackson2ObjectMapperBuilder
is not present. We would need to add spring-web
to make that happenIMO, both should be added as otherwise this starter is more a collection of libs rather than something a user can add to an app to get some additional behaviour.
Indeed, spring-boot-starter
should be added here.
Technically, this can be seen as a "collections of libs shared by several starters"; so definitely not a good citizen amongst starters, but it is still quite useful.
Also, we've just talked how this could be used by others (like Jersey) - but I still feel that adding spring-web
is the right move. In the end, we are trying to configure codecs/(de)serialization for web applications. Since Jackson also supports other formats (CBOR, CSV, etc), we should draw the line now and decide what's the scope of it.
+1 to adding spring-boot-starter
but I'm not totally sold on spring-web
. It's a shame that Jackson2ObjectMapperBuilder
lives in that package because it's not really tied to web.
Actually, I guess you could argue that JSON is mainly a web technology and the chances are if you're using JSON you're either sending or receiving it over HTTP. Unless @jhoeller has plans to relocate Jackson2ObjectMapperBuilder
and friends to to org.springframework.core.json
, we probably don't have any choice but to add the spring-web
dependency.
Having Jackson without the Jackson2ObjectMapperBuilder
is a bit pointless.
Most helpful comment
Actually, I guess you could argue that JSON is mainly a web technology and the chances are if you're using JSON you're either sending or receiving it over HTTP. Unless @jhoeller has plans to relocate
Jackson2ObjectMapperBuilder
and friends to toorg.springframework.core.json
, we probably don't have any choice but to add thespring-web
dependency.Having Jackson without the
Jackson2ObjectMapperBuilder
is a bit pointless.