导入别的类中的bean

@Configuration
class CommonContext {
  @Bean
  public MyBolt myBolt() {
    return new MyBolt();
  }
}

...

@Configuration
@Import(CommonContext.class)
class ATopologyContext { 
  // ... 
}

@Configuration
@Import(CommonContext.class)
class BTopologyContext { 
  // ... 
}
原文地址:https://www.cnblogs.com/tonggc1668/p/8652132.html