【发布时间】:2018-12-31 11:13:14
【问题描述】:
我正在运行一个简单的 rest 应用程序,redis 在 docker 容器/docker-compose 中运行。我相信,redis 必须可以使用 http://redis:6379 进行 Spring Boot 访问。但是,它会抛出错误:
018-07-22 21:53:33.972 ERROR 1 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool] with root cause
java.net.ConnectException: Connection refused (Connection refused)
我的代码是here。
【问题讨论】:
-
你应该有redis的服务定义吗?
标签: docker spring-boot redis docker-compose