java - 无法在 Spring Boot 中使用 Redis 确定数据库类型 NONE 的嵌入式数据库驱动程序类

标签 java spring spring-boot redis

我使用 Spring Boot 和 Redis。我添加了 pom.xml :

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

并创建了包含 Beans 的 RedisConfig 类 JedisConnectionFactory jedisConnectionFactoryRedisTemplate< String, Object > redisTemplate() .

当我运行应用程序时,出现错误:

***************************
APPLICATION FAILED TO START
***************************

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

我不使用嵌入式 Redis。 Redis 在本地主机上的我的计算机上工作。

application.properties :

spring.redis.host=localhost
spring.redis.port=6379

为什么会出现这个错误?

最佳答案

有几个问题:

  1. spring-boot-starter-redis 已弃用。请改用 spring-boot-starter-data-redis
  2. 删除 spring-boot-starter-data-jpa 依赖项。 Spring Data Redis 不支持 JPA,也不需要它。这实际上导致了您的错误。

关于java - 无法在 Spring Boot 中使用 Redis 确定数据库类型 NONE 的嵌入式数据库驱动程序类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44874928/

相关文章:

java - 如何在 Spring/OpenJPA 1 中重新创建更新行锁定的选择

java - 从同一帐户多次远程登录会导致所有访问 token 刷新 spring security

java - 从 log4j 迁移到 lof4j2 时的 SpringBoot 问题

java - 如何修复 "Field ... required a bean of type ... that could not be found"异常 Spring Boot

java - Play Framework 应用程序默认使用多少最大堆空间

spring - 如果redis不在线,如何配置RedisHttpSessionConfigure回退

java - 设置整数数组值的异常性能

java - 我的 Maven 构建中缺少 AbstractAnnotationConfigDispatcherServletInitializer

Java序列化——包装类

java - Android动态生成表