Project ‘org.springframework.boot:spring-boot-starter-parent:2.4.4‘ not found

问题:
Project ‘org.springframework.boot:spring-boot-starter-parent:2.4.4’ not found
解决办法:
点击File-Invalidate Caches/Restare清一下缓存重新启动
在这里插入图片描述

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring Boot提供了对Redis的集成支持,你可以通过以下步骤来使用Redis: 1. 添加Redis依赖:在`pom.xml`文件中添加Spring Data Redis依赖。例如: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> ``` 2. 配置Redis连接信息:在`application.properties`(或`application.yml`)文件中配置Redis连接信息,包括主机名、端口号、密码等。例如: ```properties spring.redis.host=127.0.0.1 spring.redis.port=6379 spring.redis.password= ``` 3. 创建Redis配置类:创建一个Java配置类,用于配置RedisTemplate和连接工厂等。例如: ```java @Configuration public class RedisConfig { @Value("${spring.redis.host}") private String redisHost; @Value("${spring.redis.port}") private int redisPort; @Value("${spring.redis.password}") private String redisPassword; @Bean public RedisConnectionFactory redisConnectionFactory() { RedisStandaloneConfiguration config = new RedisStandaloneConfiguration(redisHost, redisPort); config.setPassword(RedisPassword.of(redisPassword)); return new LettuceConnectionFactory(config); } @Bean public RedisTemplate<String, Object> redisTemplate() { RedisTemplate<String, Object> template = new RedisTemplate<>(); template.setConnectionFactory(redisConnectionFactory()); return template; } } ``` 4. 使用Redis:在需要使用Redis的地方,注入`RedisTemplate`对象,并使用其提供的方法操作Redis。例如: ```java @Autowired private RedisTemplate<String, Object> redisTemplate; public void setValue(String key, Object value) { redisTemplate.opsForValue().set(key, value); } public Object getValue(String key) { return redisTemplate.opsForValue().get(key); } ``` 这样,你就可以在Spring Boot应用中使用Redis了。你可以使用`RedisTemplate`提供的方法来操作Redis的各种数据结构,如字符串、哈希、列表等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值