SpringBoot集成Redis配置

    科技2022-07-10  156

    1.0引用Redis依赖,和测试依赖

    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> yaml或者properties配置 spring.redis.host=47.115.92.245 spring.redis.port=6379 spring.redis.password=省略别偷窥

    在这里插入代码片

    2.0创建springboot项目 3.0创建测试类 4.0 测试验证成功

    Processed: 0.022, SQL: 8