Git Product home page Git Product logo

coffee-boots's People

Contributors

codacy-badger avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar markusheiden avatar stepio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

coffee-boots's Issues

java.lang.IllegalStateException: No CacheResolver specified, and no bean of type CacheManager found. Register a CacheManager bean or remove the @EnableCaching annotation from your configuration.

I have @EnableCaching on my application class.

In application.properties I have:

# caching
coffee-boots.cache.spec.reCountries=expireAfterWrite=3d,expireAfterAccess=1d,maximumSize=500
coffee-boots.cache.spec.reInstalledCountries=expireAfterWrite=3d,expiresAfterAccess=1d,maximumSize=500

But when I try to run a test or boot my application I get:

java.lang.IllegalStateException: No CacheResolver specified, and no bean of type CacheManager found. Register a CacheManager bean or remove the @EnableCaching annotation from your configuration.

If I add a bean with a CacheManager:

@Bean
public CacheManager cacheManager() {
    return new MultiConfigurationCacheManager();
}

My application runs but it doesn't look like my cache is configured per the .properties file:

@Autowired
CacheManager cacheManager
...
cacheManager.getCache("reCountries")

gives me:

result = {org.springframework.cache.caffeine.CaffeineCache@20802} 
 allowNullValues = true
 cache = {com.github.benmanes.caffeine.cache.UnboundedLocalCache$UnboundedLocalManualCache@20804} 
  cache = {com.github.benmanes.caffeine.cache.UnboundedLocalCache@20807}  size = 1
  policy = null
 name = "reCountries"

Do I need to provide a CacheManager bean or does coffee-boots do that for me already? If it does, what am I doing wrong that causes the error I'm getting?

more details in readme.md

I understand I can try this out by myself, but in the readme.md document, can you please clarify how exactly this works in concert with Spring Boot? E.g. when you say:

coffee-boots.cache.spec.myCache=maximumSize=100000,expireAfterWrite=1m

Is that "in addition to" spring boot's:

spring.cache.type=caffeine
spring.cache.cache-names=myCache,cache2,cache3
spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s

Or, does the coffee-boots.* properties completely replace spring.cache.* properties?

I hope it is in addition and not replacement. i.e. If I use "cache2" or "cache3" in my class annotation, I get the default/global spring configuration values (500 maxSize in this case); if I use "myCache" in my annotation, I get coffee-boot values (10000 maxSize). If it doesn't work that way, I'd like to request that it does.

Thanks!

How to use refreshAfterWrite

When i add refreshAfterWrite option.
i received java.lang.IllegalStateException: refreshAfterWrite requires a LoadingCache
pls how to i use refreshAfterWrite ?

Upgrade to Spring Boot 3

Hi,
Can you please provide a version of coffee boots which is based on Spring Boot 3? This would be very helpful.
Thanks.

caches will only inherit basic-spec if they have custom properties

I would like to define a cache in code with
@Cacheable(cacheNames = "example_cache"
and have it inherit the basic-spec without any changes to property files

However, currently CaffeineSpecResolver.getCaffeineSpec will only apply the basic-spec to caches which have a non-blank value for coffee-boots.cache.spec.example_cache

Create releases (or at least tags!) for releases since 3.0.0

It's a bit confusing that if you browse https://github.com/stepio/coffee-boots the "Releases" section links to 3.0.0 as the most recent release, and even hitting "Tags" in that view doesn't show anything later. The Readme also suggests version 2.2.0.

I had to go digging to find out that I should be using 4.0.0 for SB3 support; it would be nicer to make this more discoverable for others. Hopefully not too onerous a request 😃

Consider having a default spec that can be overruled per cache name

I like to configure the caches via properties like:

coffee-boots.cache.spec.myCache1=maximumSize=100000,expireAfterWrite=1m
coffee-boots.cache.spec.myCache1=maximumSize=200000,expireAfterWrite=1m

For all caches I e.g. want expireAfterWrite=1m

It would be nice to be able to specify a default spec like:

coffee-boots.cache.default-spec=expireAfterWrite=1m

and then only overwrite the settings needed like:

coffee-boots.cache.spec.myCache1=maximumSize=100000
coffee-boots.cache.spec.myCache1=maximumSize=200000

[DepShield] (CVSS 8.1) Vulnerability due to usage of org.assertj:assertj-core:3.4.1

Vulnerabilities

DepShield reports that this application's usage of org.assertj:assertj-core:3.4.1 results in the following vulnerability(s):


Occurrences

org.assertj:assertj-core:3.4.1 is a transitive dependency introduced by the following direct dependency(s):

org.springframework.boot:spring-boot-starter-test:1.5.21.RELEASE
        └─ org.assertj:assertj-core:3.4.1

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Metrics

Trying to switch to coffee-boots, previously I could get metrics on the caches via prometheus and micrometer, when I switch to configuring the caches with coffee-boots they drop off the metrics endpoints. Any thoughts on how to get them back? I am using the same caffeinespec for all the caches, just changing the configuration from spring.cache... to coffeeboots.cache...

CaffeineSpecSpringAutoConfiguration cacheManager @ConditionalOnMissingBean by type

Hi
CaffeineSpecSpringAutoConfiguration.cacheManager is annotated with @ConditionalOnMissingBean and by default it makes a type check to determine if there is already such a bean. I think in this case we should be checking the bean by name: cacheManager since we are trying to understand if there is a default cache manager defined.
Fortunately there is a way to configure that annotation by bean name using the name attribute.
So, could you please update that annotation as:
@ConditionalOnMissingBean(name="cacheManager")

Background about how I bumped into this:
I wanted to configure a LoadingCache via properties file but it is not supported by this project. So I extended it, and using my own custom CacheManager as the default cache manager. So they are clashing because CaffeineSpecSpringAutoConfiguration is alse trying to register a bean with the same name: cacheManager
You can see some details of how I am doing it here: ben-manes/caffeine#311 in case you also want to use a LoadingCache.

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.