title: A bean with that name has already been defined in class path resource [path] and overriding is disabled
body: <p>I have the java configuration for the Spring Data Elaticsearch(using Transport Client) and ESTemplate.
  Here some except:</p>
  <pre class="lang-java prettyprint-override"><code>@Configuration
  @EnableElasticsearchRepositories(basePackages = &quot;subpackage-in-this-project&quot;)
  @PropertySource(&quot;file:path-to-file&quot;)
  public class ESConfig {
  
      @Bean
      ElasticsearchTemplate elasticsearchTemplate(Client client) {
          return new ElasticsearchTemplate(client);
      }
  
      @Bean
      Client client() { 
  // configuration of the ES client
     }
  
  }
  </code></pre>
  <p>And I have a config that extends the one above in the different project.</p>
  <pre class="lang-java prettyprint-override"><code>@Configuration
  @ComponentScan(&quot;package-prefix-that-matches-packages-in-both-projects&quot;)
  @EnableElasticsearchRepositories(basePackages = &quot;subpackage-in-this-project&quot;)
  @PropertySource(&quot;file:same-path-to-file-as-in-the-config-above&quot;)
  public class ExtendedESConfig extends ESConfig {
  
      @Value(&quot;index-name&quot;)
      private String indexName;
  
      @Bean
      public String indexName() {
          return indexName;
      }
  }
  </code></pre>
  <p>Upon executing a third Spring Boot application, which uses the dependency on the project with <code>ExtendedESConfig</code>, I get this and I can't quite understand why does it happen, started to happen after upgrading to 2.2.9.RELEASE from 2.0.5.RELEASE Spring Boot version.</p>
  <pre class="lang-sh prettyprint-override"><code>
  ***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  The bean 'elasticsearchTemplate', defined in class path resource [my/package/ESConfig.class], could not be registered. A bean with that name has already been defined in class path resource [my/other/package/ExtendedESConfig.class] and overriding is disabled.
  
  Action:
  
  Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
  
  2020-08-30 16:49:46 ERROR [main] org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter:40 - 
  </code></pre>
  <p><strong>Important remark from my comment:</strong></p>
  <blockquote>
  <p>... sadly, I am not the one who wrote this ES config and built the whole infrastructure around it. ...</p>
  </blockquote>
  <p>At the time of this question, <strong>I don't own ExtendedESConfig nor can change it.</strong></p>