Question: the value for an annotation attribute must be a constant expression?
Answer: The Java rules say that when you have an annotation, and it has a parameter that expects a primitive type (such as an int ) or a String , the value must be a constant expression. [This has nothing to do with Spring.] Roughly speaking, a constant expression is one whose value the compiler can figure out at compile time.