【发布时间】:2017-02-07 13:21:10
【问题描述】:
在春天我们可以设计如下的REST Web服务。
@RestController
public class HelloController {
@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String printWelcome(ModelMap model) {
model.addAttribute("message", "Hello");
return "hello";
}
}
当我们这样做时,@RestController & @RequestMapping 将在内部管理请求映射部分。所以当我点击 url 即http://localhost:8080/hello 时,它将指向 printWelcome 方法。
我正在研究 spring boot 执行器源代码。如果我们将在我们的应用程序中使用 Spring Boot 执行器,它将为我们提供一些端点,这些端点已作为其他 API 公开,例如健康、指标、信息。所以在我的应用程序中,如果我使用弹簧启动执行器,当我点击“localhost:8080/health”之类的 url 时,我会得到响应。
所以现在我的问题是在映射此 URL 的 Spring Boot 执行器源代码中。我调试了spring boot actuator的源代码,但是找不到端点映射的根类。
有人可以帮忙吗?
【问题讨论】:
标签: java spring spring-boot spring-boot-actuator