I see in Java when I use annotation to a method like this is not possible. It gives "Attribute must be a constant"
private static final String CONSTANT = MyClass.class.getCanonicalName();
@Timed(CONSTANT) //Attribute value must be constant
@CircuitBreaker(name = CONSTANT) //Attribute value must be constant
public String something( String something ) {
To emphasize, I am using @Timed and @CircuitBreaker here as example. Many other annotations will yield the exact same issue.
How to do it in Java? I mean, I do not want to hardcode the value here like such.
@Timed("MyClass") @CircuitBreaker(name = "MyClass")