Configure Jackson as JSON Provider in JAX-RS 2.0

前端 未结 2 2016
被撕碎了的回忆
被撕碎了的回忆 2020-12-31 07:23

I want to use Jackson as JSON provider for my JAX-RS 2.0 webservice. For JAX-RS I use Jersey 2.0 in GlassFish 4. With JAX-RS 1.x I can add



        
相关标签:
2条回答
  • 2020-12-31 08:00

    You should only need to get the implementation jar Jackson JAX-RS provider, add that to your classpath, and it should work. Version 2.x uses SPI-based auto-registration, so that you do not need anything in web.xml.

    0 讨论(0)
  • 2020-12-31 08:09

    The above code worked for me. JAX-RS 2.0 has auto discovery feature so it should detect your jersey-media-json-jackson.jar. I am using a Tomcat setup so, I had to explicitly call register(JacksonFeature.class) in my application as you do.

    0 讨论(0)
提交回复
热议问题