I am trying to implement the Spring Condition org.springframework.context.annotation.Condition as follows:
public class APIScanningDecisionMaker implements Condition { @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
However, as shown in the above code, when I read the "swagger.scanner.can.run" property, it is always NULL. In my properties file, I set it to "swagger.scanner.can.run = false".
I also tried using @Value("${swagger.scanner.can.run}") , but even this returns NULL. When I debug this method, I see that it is being called.
Just for completion, I use APIScanningDecisionMaker as follows:
@Configuration @EnableSwagger @Conditional(APIScanningDecisionMaker.class) public class CustomSwaggerConfig {
Is there a reason why "swagger.scanner.can.run" is retrieved as NULL?
Raj source share