title: Spring bean implementing two interfaces
body: <p>I am new to Springs so please don't mind if my question is dumb</p>
  
  <p>I have a class which implements two interfaces</p>
  
  <pre><code>public class AAA implements BBB, CCC {
  
  }
  
  public interface BBB {
    void method BBB_method();
  }
  
  
  public interface CCC {
    void CCC_method();
  }
  </code></pre>
  
  <p>I am defining bean object in Context class as follows:</p>
  
  <pre><code>public class Context {
  
     @Bean
     public BBB myObject(){
         return new AAA();
     }
  
     @Bean
     public CCC myObject(){    //Issue is here
          return new AAA();    //Duplicate API name not allowed
     }
  }
  </code></pre>
  
  <p>I have autowired the beans in 2 different class as follows:</p>
  
  <pre><code>@Autowired
  private BBB myObject;
  
  @Autowired
  private CCC myObject;
  </code></pre>
  
  <p>What should be the best way to autowire this and define the bean in the Context class? And does defining 2 bean object in Context.java make sense? How to resolve this situation where I want my bean to be autowired to two different interfaces ( and object name being the same..as in my case its myObject) ? Your response is very much appreciated. Thank You !</p>