导入别的类中的bean

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

...

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

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

 

posted @ 2018-03-26 17:04  tonggc1668  阅读(138)  评论(0编辑  收藏  举报