1

I'm using Spring boot 1.5.4.RELEASE with Jersey, I want to use Actuator to expose the metrics of my endpoints, the problem is that it will be a new release so I don't want to change the path of my endpoints because there are already some applications using them, lets see one of them:

localhost:8080/employees/{employeeId}

In order to configure actuator with Jersey I have to make a change to my JerseyConfig class to:

@Component
@ApplicationPath("/api")
public class JerseyConfig extends ResourceConfig{...} 

If I make the previous change the actuator endpoints work properly but my endpoint will be :

localhost:8080/api/employees/{employeeId}

And it will require changes in the applications that are consuming my endpoints.

The question is how can I make the actuator endpoints work without change the Jersey's application path.

Additional notes:

  1. I'm using also jolokia to expose my metrics vía REST in order that my telegraf plugin can consume them.
  2. I don't want to expose the actuator endpoints in a different port
  3. The question is not duplicated because all the questions i found in Stackoverflow says that I have to change the basepath of jersey both i didn't found how to make it work without change it
  4. The application will be deployed as a war file in an external tomcat

Please let me know if you need additional details

------------------------ Not duplicated question This question is not duplicated with Spring Boot 2 Actuator endpoints inaccessible with Jersey because I can't change the Jersey's base path because there are already many applications consuming my endpoints so I need to change the actuator base path and make it work together with Jersey

fred
  • 9,663
  • 3
  • 24
  • 34
  • This is not the same question, I think you didn't read the aditional notes it says that I have to change the Jersey's base path but in my question I'm saying that it doesn't work for me because I can't change the base of my endpoints so I need to change the base path of the actuator endpoint – Alejandro Agapito Bautista Oct 10 '18 at 13:46
  • Have you tried the **other** solution listed in that duplicate: _"or you can configure Jersey as a filter (instead of the default servlet) and set a property to make Jersey forward all requests it doesn't know down to the servlet container."_ – Mark Rotteveel Oct 10 '18 at 15:08
  • Does not sound possible - use a reverse proxy. Can also have a look at https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-monitoring.html#production-ready-customizing-management-server-context-path – charlb Oct 10 '18 at 19:33
  • 1
    I'm very careful in marking duplicates. The [duplicate](https://stackoverflow.com/questions/51620437/spring-boot-2-actuator-endpoints-inaccessible-with-jersey) that I marked had _**TWO**_ solutions. The first one where you had to change the base uri is the one you did not want. And the second, as @MarkRotteveel mentioned where need to change Jersey to a Filter and set a property was another one. What you want is the second one. – Paul Samsotha Oct 11 '18 at 18:12
  • I still think that this is a duplicate of https://stackoverflow.com/questions/51620437/spring-boot-2-actuator-endpoints-inaccessible-with-jersey?noredirect=1&lq=1 . Did you actually try that second solution (it works, I know it works, because I have had to apply it myself in a project). – Mark Rotteveel Oct 11 '18 at 18:13

0 Answers0