Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to self describe a REST api with Spring?

I'm using spring-mvc to create servlets like:

@RestController
public class MyServlet {
   @GetMapping("/test")
   public MyRsp test(MyReq req) {
         //...
   }
}

Now if the user accesses the root of my app localhost:8080/my-app, it should show a list of GET and POST methods available. At best with possible input parameters, acceptable headers etc.

Question: is that possible with any spring framework, like HATEOAS?

I'd expect a framework to auto detect any @RestController and included methods.

Or would I have to create that overview page myself?

like image 720
membersound Avatar asked Jun 13 '17 10:06

membersound


1 Answers

You should must look into this

To integrate it in spring you can refer this

Swagger is one of the best framework to expose RESTful API's.

like image 138
utsav anand Avatar answered Sep 21 '22 16:09

utsav anand