restful service interface with jersey

前端 未结 5 1012
日久生厌
日久生厌 2020-12-11 07:44

Can I create a restful service with interface and implementation class?

If so, will all JAX-RS related imports go into the interface?

I am using jersey2.4 an

5条回答
  •  误落风尘
    2020-12-11 08:30

    Here's a solution I came across after a few trials (I'm working with jetty 9 and jersey 2.13): instead of annotate the interface (with @Path("/abc")), try to annotate the implementation class instead.

    I think this makes good sense since interface are 'abstract' and not supposed to be bound to physical paths. This way, the interface can be reused in different paths.

提交回复
热议问题