accessor private is not suitable for a method variable.
If you look at the definition of the @Value annotation, it can only be placed at the field level, in the PARAMETER or METHOD parameter.
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Value {
Thus, either you declare the name as an attribute of the class, or as a parameter of a method ...
source share