首页 > 解决方案 > 如何在 akka http 上设置 file-io-dispatcher?

问题描述

当我试图开始时,akka我遇到了这个错误ConfigFactory.load()

Exception in thread "main" com.typesafe.config.ConfigException$UnresolvedSubstitution: reference.conf @ jar:file:/home/faoxis/.ivy2/cache/com.typesafe.akka/akka-http_2.12/jars/akka-http_2.12-10.1.5.jar!/reference.conf: 51: Could not resolve substitution to a value: ${akka.stream.blocking-io-dispatcher}

在源代码中我发现了这个:

# Fully qualified config path which holds the dispatcher configuration
  # to be used by FlowMaterialiser when creating Actors for IO operations.
  file-io-dispatcher = ${akka.stream.blocking-io-dispatcher}

我有一个问题。我可以在不使用环境变量的情况下使用一些默认设置akka.stream.blocking-io-dispatcher吗?也许我可以设置application.conf

标签: scalaakkaakka-streamakka-http

解决方案


你唯一能做的application.conf就是Environment Variables覆盖定义在reference.conf.

因此,您可以akka.stream.blocking-io-dispatcher在其中任何一个中进行配置。

奇怪的是通常有一个默认值设置。我akka-http与 Play 一起使用,我从来不需要设置任何配置。

请参阅此处的akka-streams配置:流配置


推荐阅读