0

Is it possible to pass a static variable defined in a class as argument to @Qualifier annotation? I tried the below format and a few other variations, but nothing worked.

@Qualifier("T(com.test.Constants).BEAN_NAME")

Spring-el works in @Value annotation. For example, below example is valid:

@Value("#{ systemProperties['user.region'] }")
dsatish
  • 1,041
  • 15
  • 27

1 Answers1

4

Try with @Qualifier(com.test.Constants.BEAN_NAME)

Jose Luis Martin
  • 10,459
  • 1
  • 37
  • 38
  • thanks- it worked. I couldn't find this info in the documentation. Can you tell me where you found this info or a document I can read? – dsatish May 10 '13 at 12:44
  • 1
    Annotation values are compile-time constants. see http://docs.oracle.com/javase/6/docs/technotes/guides/language/annotations.html. – Jose Luis Martin May 10 '13 at 15:11
  • No, don't use constants! Use a annotation like described here: this: https://stackoverflow.com/q/69263925/13822943 – 11_22_33 Sep 21 '21 at 08:39