MessageBodyWriter not found for media type=application/json when returning JSON in REST web service with Jersey

后端 未结 5 1601
难免孤独
难免孤独 2020-12-19 16:20

I am trying to create a very simple REST service using Jersey. Here is the service code

@Path(\"/UserService\")
publ         


        
5条回答
  •  一整个雨季
    2020-12-19 16:24

    To use Jackson 2.x as your JSON provider you need to add jersey-media-json-jackson module to your pom.xml file:

    
        org.glassfish.jersey.media
        jersey-media-json-jackson
        2.22.2
    
    

    And then register the JacksonFeature in your Application/ResourceConfig subclass.

    For more details, have a look at Jersey documentation.

提交回复
热议问题