question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Spring @Cacheable

See original GitHub issue

Hi Team, First, thank you for the incredible work you’ve done on this amazing project.

Describe the bug When using Spring @Cacheable annotation within a redis implementation, I can’t see any span reported to zipkin. Spring Cloud : 2.2.6.RELEASE Spring-Boot : 2.3.5.RELEASE

Sample Here a sample and simple code for Cacheable usage The main controller…

 @RequestMapping(value = "/user/v1/{idUser}",
        produces = { "application/json" }, 
        method = RequestMethod.GET)
public ResponseEntity<String> getUser(Integer idUser) {
        Optional<String> userInformation = myService.getUserName(idUser);
        return userInformation.isEmpty() ? ResponseEntity.noContent().build() : ResponseEntity.ok(userInformation.get());
    }

The service…

 @Cacheable(value = "myCacheNameInRedis")
    public Optional<String> getUserName(Integer idUser) {
        //call repository with idUser;
    }

Dependencies used :

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zipkin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>

Thank you

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Nankhcommented, Dec 17, 2020

Hi team,

just some words to tell you that, this error is due to a custom LettuceFactory and we did not add BraveTracing when creating it.

Have nice day folks

0reactions
spring-cloud-issuescommented, Dec 17, 2020

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Guide To Caching in Spring - Baeldung
A Guide To Caching in Spring · 1. The Cache Abstraction? · 2. Getting Started · 3. Enable Caching · 4. Use Caching...
Read more >
32. Caching - Spring
The Spring Framework provides support for transparently adding caching to an application. At its core, the abstraction applies caching to methods, ...
Read more >
Spring Caching | Java Development Journal
Spring 3.1 introduced support for transparently adding caching into an existing Spring application. Similar to the transaction support, ...
Read more >
Spring Boot Caching 101 - Auth0
This method-level annotation lets Spring Boot know that the return value of the annotated method can be cached. Each time a method marked...
Read more >
Implementing a Cache with Spring Boot - Reflectoring
The Spring cache abstraction gives us the possibility to use an abstract API to access the cache. Our business code can use this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found