HystrixCommand注释导致会话关闭错误

时间:2017-03-15 22:23:57

标签: java spring hibernate spring-mvc hystrix

我有一个弹簧应用程序,我试图在via Hystrix上使用Circuit Breaker模式。我使用@HystrixCommand注释在我的服务中标记了一个方法。此方法调用存储库,在没有@HystrixCommand注释的情况下工作正常。

但是,只需添加注释就会给我一堆运行时异常 - org.hibernate.SessionException:会话已关闭!和java.net.ConnectException。我对@HystrixCommand或者春天不太了解,不能真正了解这里发生的事情。在使用Hystrix之前,我需要了解一下我的存储库连接吗?我基本上只是遵循了这里的指南:https://spring.io/guides/gs/circuit-breaker/

感谢任何反馈或潜在客户。

1 个答案:

答案 0 :(得分:2)

只需将以下配置添加到您的properties / yml文件

即可
hystrix.command.default.execution.isolation.strategy: SEMAPHORE

Here is some documentation for further reading

相关问题