Using @Region with conditionals

43 Views Asked by At

I’m creating a gemfire region using spring data geode. I have used the @Region annotation on my entity class.

I need to create this region based on a property from my application properties file.

Is there a way to achieve this ?

I tried to use @ConditionalOnExpression along with the @Region annotation. The region is never created.

PFB source code.

@ConditionalOnExpression(value=“${cache.enable.user}”)
@Region(“Users”)
Public class User {
     String name;
     int age;
}

The property is available and the same conditional expression is working on other beans annotated with @Component.

Please help to let me know if we can conditionally create regions based on the property.

Thanks !

0

There are 0 best solutions below