GithubHelp home page GithubHelp logo

Comments (3)

ranishwetha avatar ranishwetha commented on April 28, 2024

Hi, any update or observation on this?

from spring-boot-data-geode.

jxblum avatar jxblum commented on April 28, 2024

Hi @ranishwetha -

Alright, where to begin?

  1. First, you state...

In my application, I don't need client cache either. Is there a way to avoid using this?

What do you mean by, "I do not need a ClientCache?"

Why would you use Spring Boot for Pivotal GemFire (SBDG) in the first place if you did not need a ClientCache (?), where it would seem you are deploying your Spring Boot app to PCF and using PCC (??). In order to connect to a PCC cluster in PCF, you need a ClientCache instance. If you have defined GemFire objects (e.g. Regions) in your application configuration to manage your data, then those objects require a cache instance.

It would also seem your are using PCC as a "caching provider" / backing store for the implied use of Spring's Cache Abstraction in your application given the declaration of the @EnableGemfireCaching annotation.

Given the above, this is why you getting the follow error message by Spring Boot on startup:

Consider defining a bean named 'gemfireCache' in your configuration

  1. Second, when using Spring Boot for Pivotal GemFire (SBDG), you do not need to "explicitly" annotate your application configuration class (i.e. GemFireConfiguration) with any of: @ClientCacheApplication, @EnableGemfireCaching, @EnablePdx nor @EnableSecurity since, OOTB, SBDG provides auto-configuration for all of these features.

SBDG provides you with a ClientCache instance, by default. It also enables PDX, by default. It can detect the context in which your app is deployed/running (e.g. PCF when using PCC) and automatically apply the necessary/required Security settings, by default. And, when either Apache Geode or Pivotal GemFire is on your application's classpath, then SBDG will automatically use GemFire or Geode as a "caching provider" in Spring's Cache Abstraction, by default.

You typically do not declare any of the SDG's 3 cache type annotations [@ClientCacheApplication, @PeerCacheApplication, @CacheServerApplication] when using SBDG unless you want to A) override the cache type (again, a ClientCache by default) to use another type of cache (e.g. a "peer" cache instance when you want your application to be "peer" member of the GemFire/PCC cluster, which is rare) or B) you want to supply custom, very-specific cache configuration (e.g. subscriptionEnabled = true on the client).

Of course, there are other ways to accomplish the later (B), i.e. supplying additional, custom cache configuration, either by way of Properties or using a Configurer bean.

To get these "default" features out of the box, you simply only need to declare org.springframework.geode:spring-gemfire-starter in your application dependencies, thereby adding the LIB to your application's classpath at runtime.

  1. Third, you do not need to specifically annotate your application configuration class with @Configuration either, since the @ClientCacheApplication annotation, or even Spring Boot's @SpringBootApplication annotation is already (indirectly) meta-annotated with @Configuration. For instance.

The only annotations you need in your case to get started, really, is...

@SpringBootApplication
class MySpringBootApplication { .. }

... again, providing the org.springframework.geode:spring-gemfire-starter dependency (LIB) is on your application's classpath at runtime.

Done!

  1. Finally, as for logging...

Neither the @ClientCacheApplication annotation, nor SDG in general, prevent you from customizing the logging for a GemFire client or server itself.

Under the hood, Pivotal GemFire/PCC (and by extension, Apache Geode) uses the Log4j framework as its logging facade and implementation. Therefore, you can supply the logging configuration for a GemFire/PCC app by following the documentation.

The @ClientCacheApplication annotation simply gives you the ability to affect the logLevel.

And, since you do not explicitly need to specify the @ClientCacheApplication annotation in a SBDG application, and thus have no direct way to set logLevel by way of the @ClientCacheApplication annotation logLevel attribute, SDG provides the @EnableLogging annotation, which implies this setup.

Either way, it seems in your case, you should be following the "advice" in the opening paragraphs, here.

Hope this helps!

Regards,
@jxblum

from spring-boot-data-geode.

ranishwetha avatar ranishwetha commented on April 28, 2024

Thanks John! This is helpful.

from spring-boot-data-geode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.