Im trying to connect to Pivotal Cloud Cache server Regions.
I'm using @EnableClusterAware
and trying to configure the client Regions via ClientRegionFactoryBean
as below:
@Bean("clientRegion")
ClientRegionFactoryBean someClientRegion(GemFireCache gemfire) {
// ...
}
Either GemFireCache
or ClientCache
beans are not available with the annotation @EnableClusterAware
. It's available only with @ClientCacheApplication
.
Is there any annotations that needs to be used in conjunction with @EnableClusterAware
so that GemFireCache
gets injected?
Please help.
When Spring Boot for Apache Geode, or alternatively GemFire, (SBDG) is on the classpath of your Spring Boot application (see here), then SBDG auto-configuration will automatically create and configure a
ClientCache
instance for you (see here).The
@EnableClusterAware
annotation is simply a development-time, SBDG annotation that enables you to switch between environments (e.g. local vs. managed, such as when pushing your Spring Boot application up to run in PCF, connected to PCC, and then testing locally in your IDE) without having to change any configuration (hence the goals).The
@EnableClusterAware
annotation does not create any GemFire/Geode cache instances for you. Only SBDG's auto-configuration, or declaring an explicit SDG annotation (e.g.@ClientCacheApplication
) will do that for you. Still, when using SBDG auto-configuration, you do not need an explicit SDG cache application annotation, like@ClientCacheApplication
, since SBDG auto-configuration (again) creates and configures aClientCache
instance by default.If
ClientCache
is not provided (auto-configured), then you are not:One or more of these have to be true.