title: Spring Boot 2.0 Not Registering Custom Actuator Endpoint Bean
body: <p>I'm trying to add a custom actuator endpoint in Spring Boot 2.0.2.RELEASE application.
  I'm following <a href="https://spring.io/blog/2017/08/22/introducing-actuator-endpoints-in-spring-boot-2-0" rel="nofollow noreferrer">the official guidelines</a>, <a href="https://github.com/spring-projects/spring-boot/wiki/Migrating-a-custom-Actuator-endpoint-to-Spring-Boot-2" rel="nofollow noreferrer">the official migration guide</a> and also <a href="http://www.baeldung.com/spring-boot-actuators" rel="nofollow noreferrer">this post</a>.</p>
  
  <p>I am able to configure everything via properties: hide/expose endpoints, change base path etc. Everything works, except my custom endpoint bean is not picked up by <code>WebMvcEndpointHandlerMapping</code>. It simply doesn't show up in these famous logging lines:</p>
  
  <pre><code>EndpointLinksResolver        : Exposing 2 endpoint(s) beneath base path '/actuator'
  WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map&lt;java.lang.String, java.lang.String&gt;)
  WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map&lt;java.lang.String, java.lang.String&gt;)
  WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected java.util.Map&lt;java.lang.String, java.util.Map&lt;java.lang.String, org.springframework.boot.actuate.endpoint.web.Link&gt;&gt; org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
  </code></pre>
  
  <p>These three lines is all I get. I can access <code>/actuator/health</code> and <code>/actuator/info</code> without any trouble, but not my custom endpoint. I get 404 obviously.</p>
  
  <p>What I tried so far:</p>
  
  <ul>
  <li>Checked that my endpoint class is registered in the context as a bean.</li>
  <li>Exposed it explicitly via yaml configuration.</li>
  <li>Exposed everything via <code>management.endpoints.web.exposure.include=*</code></li>
  <li>Removed all the management configuration completely, because it should be actually available by default.</li>
  <li>Triple checked the endpoint id.</li>
  <li>Renamed the endpoint id.</li>
  </ul>
  
  <p>Any ideas of what I can at least look into? All the questions I found so far end up in person not realizing they need <code>@Component</code> annotation too.</p>
  
  <p>Ah, here is my class by the way:</p>
  
  <pre><code>@Component
  @Endpoint(id = "hello")
  public class HelloEndpoint {
  
      @ReadOperation
      public String sayHello() {
          return "Hello!";
      }
  }
  </code></pre>