1

Hi guys I have a doubt I am trying to inject or only initialize filter request only when a property value is enabled.

When the value es false this filter not will be inject o intercept requests.

For example in Spring Framework you ca use @ConditionalOnProperty for this scenario but in Quarkus I am testing whit @IfBuildProperty and @LookupIfProperty but the results in my test not work like Spring features.

Properties of quarkus: enable.filter.request=true #false: not filter or initialize this filter

My reference is this: https://github.com/quarkusio/quarkus/issues/20099

  • 1
    `@IfBuildProperty ` works on build time properties only. `@LookupIfProperty` does work with runtime configuration, as mentioned in https://quarkus.io/guides/cdi-reference#declaratively-choose-beans-that-can-be-obtained-by-programmatic-lookup. What sort of problem are you seeing? – geoand Jul 04 '22 at 05:24
  • Thanks for your response . I wanna only use ContainerRequestFilter when properties in yaml is enable in true, when is false this filter not intercept or filter requests. In Spring it´s resolved whit @ConditionalOnProperty you can inject a bean or no depends of the value in properties. – Roger Huamani Jul 06 '22 at 18:24
  • 1
    Why not just inject the property and check it when the filter is executed? – geoand Jul 08 '22 at 10:46
  • @geoand still, how does one achieve the `@ConditionalOnProperty` in quarkus? – Eugene Feb 17 '23 at 10:38
  • See https://quarkus.io/guides/cdi-reference#enable_build_properties and https://quarkus.io/guides/cdi-reference#declaratively-choose-beans-that-can-be-obtained-by-programmatic-lookup – geoand Feb 20 '23 at 09:38

0 Answers0