We have a large application built on Spring 3.
We're using this example to build a report of all the endpoints of the application.
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
@Controller
public class EndpointDocController {
private final RequestMappingHandlerMapping handlerMapping;
@Autowired
public EndpointDocController(RequestMappingHandlerMapping handlerMapping) {
this.handlerMapping = handlerMapping;
}
@RequestMapping(value="/endpointdoc", method=RequestMethod.GET)
public void show(Model model) {
model.addAttribute("handlerMethods", this.handlerMapping.getHandlerMethods());
}
}
It would be really helpful if this report could include documentation about the endpoint.
My question is: In Spring 3 Web - is it possible to embed metadata as documentation in the RequestMapping annotation?