title: Spring Tool Suite - Search for bean declaration by id OR alias
body: <p>I'm using Spring Tool Suite (STS) to manage a large Java Spring project. <strong>Is there a function in STS that allows one to find the declaration of a particular bean by its alias?</strong> </p>
  
  <p>For example, if I have the following property in a Java class:</p>
  
  <pre><code>@Resource
  private WidgetService widgetService;
  </code></pre>
  
  <p>I know that this property will be auto-wired from a Spring bean with the name <code>"widgetService"</code>. The bean injected will be an instance of a class that implements the interface <code>WidgetService</code>. The implementation(s) may not be located in the same package as the interface. <strong>I need a way to quickly determine from that property declaration which implementation will be injected.</strong></p>
  
  <p>I tried searching for <code>widgetService</code> using the Spring Beans Search, but it came up empty. It came up empty because the bean is defined as follows:</p>
  
  <pre><code>&lt;alias alias="widgetService" name="defaultWidgetService" /&gt;
  &lt;bean id="defaultWidgetService" class="namespace.DefaultWidgetService"/&gt;
  </code></pre>
  
  <p>There's the answer to my search (<code>DefaultWidgetService</code>), but it's inside a bean named "defaultWidgetService". Since the bean that is used to autowire the <code>@Resource</code> is aliased, the Spring Beans Search doesn't work, as it only has options to search by name, class, etc, but not by alias.</p>
  
  <p>I know I can just use a File Search and search for <code>alias="widgetService"</code> but because of the size of the project searching by text is quite slow. I could also examine the property at debug time and get the class of the injected bean, but that is also cumbersome. Java Search is quick because it is indexed, and Spring Beans Search is quick for the same reason. But I wonder: why I am using STS (which adds extra time to my builds so STS can index the Spring beans) if it won't help me with finding aliased beans?</p>