gpt4 book ai didi

spring-boot - spring-boot添加Redis(spring-boot-starter-data-redis)依赖后报错

转载 作者:行者123 更新时间:2023-12-05 07:33:24 53 4
gpt4 key购买 nike

当我将以下依赖项添加到 pom.xml 时

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

出现以下错误

2018-05-31 12:02:38.217 INFO 1416 --- [ost-startStop-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2018-05-31 12:02:39.233 ERROR 1416 --- [ost-startStop-1] o.s.b.c.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'registerCorePageControllerServlet' defined in com.amd.apps.employee.cloud.AddonApplication: Unsatisfied dependency expressed through method 'registerCorePageControllerServlet' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authenticationContextImpl' defined in URL [jar:file:/C:/Users/shiv/AppData/Local/Temp/employee.cloud-1.0.0.jar-spring-boot-libs-1766ddea-c2ae-424e-9565-d00395eb0d5c/core.cloud-1.0.0.jar!/com/amd/apps/cloud/service/common/AuthenticationContextImpl.class]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'companyServiceImpl' defined in URL [jar:file:/C:/Users/shiv/AppData/Local/Temp/employee.cloud-1.0.0.jar-spring-boot-libs-1766ddea-c2ae-424e-9565-d00395eb0d5c/core.cloud-1.0.0.jar!/com/amd/apps/cloud/service/directory/impl/CompanyServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.connect.spring.AtlassianHostRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

但是,如果我删除此依赖项,一切都会完美无缺。 Redis 服务已配置、正在运行且可访问。但是我也看到了下面的消息,我在正常执行期间看不到这些消息

2018-05-31 12:02:28.955 INFO 1416 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2018-05-31 12:02:29.071 INFO 1416 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data JPA - Could not safely identify store assignment for repository candidate interface com.atlassian.connect.spring.AtlassianHostRepository. 2018-05-31 12:02:29.171 INFO 1416 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!

最佳答案

问题是由 RedisRepositoriesAutoConfiguration 引起的。它仅使用默认配置重复注册 EnableRedisRepositories,默认配置为空 basePackages。要解决此问题,您可以通过以下方式排除 RedisRepositoriesAutoConfiguration:

@SpringBootApplication(
exclude = { RedisRepositoriesAutoConfiguration.class })

关于spring-boot - spring-boot添加Redis(spring-boot-starter-data-redis)依赖后报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50618577/

53 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com