spring-boot-starter-redis和spring-boot-starter-data-redis的依赖的区别

贝凯
2023-12-01

 spring-boot-starter-redis 1.4.1.RELEASE版本

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

具体引入的依赖是

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

spring-boot-starter-data-redis 2.5.3版本

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

具体引入的依赖:

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      <version>2.5.3</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.data</groupId>
      <artifactId>spring-data-redis</artifactId>
      <version>2.5.3</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.lettuce</groupId>
      <artifactId>lettuce-core</artifactId>
      <version>6.1.4.RELEASE</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>

对比可以看出两个依赖最大的区别是:前者使用了jedis,后者使用了lettuce


如果搭建springcloud项目,使用spring-boot-starter-data-redis更合适。

 类似资料: