0

I have an old spring boot application (1.5.0-FINAL) and I can't change this version. I want to add redis to my application, that's what I did:

1) added the maven dep:

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
        <version>1.5.10.RELEASE</version>
    </dependency>

2) Added the property to my boot

@EnableCaching
public class MySpringBootApp{

3) Added config properties to check if it starts the connection:

spring.cache.type: redis
spring.redis.host: 192.168.99.100
spring.redis.port: 6379

The host/port above do not exist: I just want to see something like "connection error" on boot to make sure I configured everything but nothing appears! It seems that spring boot just doesn't try to use a cache.

Am I missing something?Maybe my spring boot version is too old?

Phate
  • 6,066
  • 15
  • 73
  • 138

1 Answers1

1

Spring Boot parent pom already defines the versions of the starters, so remove the version from spring-boot-starter-data-redis dependency.

Your pom.xml would have at least these dependencies.

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.10.RELEASE</version>
    <type>pom</type>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

Next, @EnableCaching will look for beans with @Cacheable or @CachePut annotations.

jordiburgos
  • 5,964
  • 4
  • 46
  • 80