title: how to get the class annotation with @SpringBootApplication
body: <p>The spring searches components base for the class annotated with <code>@SpringBootApplication</code>, reference from <a href="https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE/reference/htmlsingle/#using-boot-locating-the-main-class" rel="nofollow noreferrer">Locating the Main Application Class</a>.
  When I write my own component, I want to be able to use this path as well, but I don't know how to get it.</p>
  
  <p>for example:</p>
  
  <pre><code>@SpringBootApplication
  public class Application {
  
  public static void main(String[] args) {
      SpringApplication.run(Application.class, args);
  }
  
  public static class SomeComponent {
      //I use this to scan my custom annotation
      private String basePackage;
  
      public SomeComponent(String basePackage) {
          this.basePackage = basePackage;
      }
  }
  
  @Configuration
  public static class SomeComponentConfiguration {
  
      @Value("${spring.some-component.base-package:}")
      private String basePackage;
  
      @Bean
      public SomeComponent someComponent() {
          if (basePackage == null) {
              //TODO how to get the Application.class as default path commonly
              basePackage = Application.class.getPackage().getName();
          }
          return new SomeComponent(basePackage);
      }
  }
  }
  </code></pre>