0

JSR-330 provide @Qualifier to qualifies beans. For example, define the following qualifier annotation.

@Qualifier
@interface Category{
  String value();
}

and use it like this

@Bean
@Category("simple")
SomeThing get(){
  return ...
}

@Inject
@Category("simple")
SomeThing sth;

It does work.

But how can I get the bean from ApplicationContext?

ApplicationContext context
context... // how to get the @Category("simple") bean
Dean Xu
  • 4,438
  • 1
  • 17
  • 44

0 Answers0