带弹簧靴的执行器 [英] Actuator with Spring boot Jersey

查看:109
本文介绍了带弹簧靴的执行器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Web应用程序中使用Jersey入门版.

I'm using Jersey starter in my web application.

org.springframework.boot spring-boot-starter-jersey 1.4.2发布

org.springframework.boot spring-boot-starter-jersey 1.4.2.RELEASE

尝试将Actuator端点集成到我的应用程序中.使用以下maven依赖项

Trying to integrate the Actuator endpoints into my application.Used the following maven dependency

org.springframework.boot 弹簧启动启动器执行器 1.5.2.发布 org.springframework.boot 弹簧启动启动器网络 1.5.2.发布

org.springframework.boot spring-boot-starter-actuator 1.5.2.RELEASE org.springframework.boot spring-boot-starter-web 1.5.2.RELEASE

当我访问健康端点时,它给我404错误. http://localhost:8080/context/health

When I access the health endpoint, it was giving me 404 error. http://localhost:8080/context/health

我是否需要向我的应用程序添加任何其他配置类以初始化执行器? 谁能指出我正确的方向?

Do I need to add any other configuration class to my application that will initialize the actuator? Can anyone point me in the correct direction?

推荐答案

很有可能您正在使用/*(如果未指定,则为默认值)进行Jersey映射.问题在于,泽西岛将获得所有请求.它不知道是否需要转发到任何执行器端点.

Most likely you are using /* (default if not specified) for the Jersey mapping. The problem is that Jersey will get all the request. It does not know that it needs to forward to any actuator endpoints.

有关解决方案的信息,请参见这篇文章.更改Jersey的映射,或者更改Jersey用作过滤器而不是servlet.然后将Jersey属性设置为转发对未知URL的请求.

The solutions are described in this post. Either change the mapping for Jersey, or change Jersey to be used as filter instead of a servlet. Then set the Jersey property to forward requests for URLs it doesn't know.

这篇关于带弹簧靴的执行器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆