Jersey中集成actuator
Spring Boot 官方Reference中描述如下:
80.3 Actuator and Jersey
Actuator HTTP endpoints are only available for Spring MVC-based applications. If you want to use Jersey and still use the actuator you will need to enable Spring MVC (by depending on spring-boot-starter-web, for example). By default, both Jersey and the Spring MVC dispatcher servlet are mapped to the same path (/). You will need to change the path for one of them (by configuring server.servlet.path for Spring MVC or spring.jersey.application-path for Jersey). For example, if you add server.servlet.path=/system into application.properties, the actuator HTTP endpoints will be available under /system.
此处文档有误。添加属性server.servlet.path=/system,输出为
2017-05-18 15:07:55.741 INFO 18376 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'com.hitec.surfservice.config.JerseyConfig' to [/*]
2017-05-18 15:07:55.745 INFO 18376 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
可见dispatcherServlet仍然映射至/,也就是说配置没有起作用。很快,在github上查找到了使用server.servletPath属性代替,即可满足要求,输出如下。
2017-05-18 15:07:55.741 INFO 18376 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'com.hitec.surfservice.config.JerseyConfig' to [/*]
2017-05-18 15:07:55.745 INFO 18376 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/system/*]