3

I want to inject spring properties into Annotation but I can't do it directly. I have annotation :

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@StepDefAnnotation
@Documented
public @interface When {
    String value();

    long timeout() default 0L;
}

And I want to insert it like this @When(value="some.value.from.properties") or like this @When(value=@Value("some.value.from.properties"))

Adriano
  • 874
  • 2
  • 11
  • 37
  • 1
    Why don't you use the `ConditionalOnProperty` from Spring? https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/condition/ConditionalOnProperty.html – Sofo Gial Jan 16 '19 at 14:53
  • 1
    Possible duplicate of [how to apply user defined properties value to @RequestMapping](https://stackoverflow.com/questions/36885641/how-to-apply-user-defined-properties-value-to-requestmapping) – Marc Tarin Jan 16 '19 at 15:07
  • Look at this, @Adriano: https://stackoverflow.com/questions/20350961/spring-expression-language-in-custom-annotation – xerx593 Jan 16 '19 at 15:13
  • @MarcTarin: ??? – xerx593 Jan 16 '19 at 15:15
  • @Sofo Gial I want to insert property into another annotation property not on Simple java property. I think that wont be work – Adriano Jan 16 '19 at 15:59

0 Answers0