title: Spring Boot Actuator Custom RestControllerEndpoint with RequestMapping Annotation on class level
body: <p>I have some custom actuator endpoints which should have the same parameters after the endpoint id. Therefore I use the <code>@RestEndpointController</code> annotation to get "full" control over the endpoints via MVC annotations. But I recognized a problem when I use the <code>@RequestMapping</code> annotation on class level on my RestEndpointController class.</p>
  
  <p>My sample implementation:</p>
  
  <pre><code>@Component
  @RestControllerEndpoint(id = "tenant")
  @RequestMapping("customer/{id}")
  public class TenantEndpoint {
  
      @GetMapping
      public String getTenantById(@PathVariable("id") String customerId) {
          return "Tenant_" + customerId;
      }
  }
  </code></pre>
  
  <p>with the following application.properties</p>
  
  <pre><code>management.endpoints.web.exposure.include=health, info, metrics, tenant
  </code></pre>
  
  <p>and my pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.2.1.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.example&lt;/groupId&gt;
      &lt;artifactId&gt;demo&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;demo&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;11&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>when running this app, there are two endpoints registered in Spring Boot</p>
  
  <ul>
  <li>/actuator/tenant/customer/{id}</li>
  <li>/customer/{id}</li>
  </ul>
  
  <p>How can I avoid the second (non actuator) endpoint to be registered?
  Or is it a bug of Actuator / Spring-Boot?</p>