Multiple resouceBean configuration in CXF using Spring

前端 未结 4 1003
迷失自我
迷失自我 2021-01-03 08:06

I\'m using CXF RS 2.5.1 with Spring 3.0.6-RELEASE. I would like to have multiple implementation classes for \"a single endpoint\". I see that this issue was reported and fix

4条回答
  •  无人及你
    2021-01-03 08:41

    I solved this problem by moving part of the @Path mapping to the service bean class. In your case:

    BalanceService

    @Path("/balance")
    @Produces("application/xml")
    public class BalanceService {
        @GET
        @Path("/{id}")
        public String getBalance(@PathParam("id") long id) {
            ...
        }
    }
    

    TransferService

    @Path("/transfer")
    @Produces("application/xml")
    public class TransferService {
    
        @GET
        @Path("/{id}")
        public String getTransfer(@PathParam("id") long id) {
           ...      
        }
    }
    

提交回复
热议问题