Use different paths for public and private resources Jersey + Spring boot

前端 未结 3 1231
离开以前
离开以前 2020-12-16 16:16

I\'m using Spring boot + Jersey + Spring security, I want to have public and private endpoints, I want an schema as follow:

  • /rest -- My root c
3条回答
  •  一生所求
    2020-12-16 16:50

    You won't be allowed to create two beans for your Resource Class. You can achieve what you are trying to achieve using a single Resource Class as well.

    Here is an example:

    @Path("rest")
    public class SampleResourceClass {
    
      @Path("/public/pings")
      @GET
      public Responce getPings(){
        /* Code Here */
      }
    
      @Path("/private/accounts")
      @GET
      public Response getAccounts(){
        /* Code Here */
      }
    }
    

提交回复
热议问题