如何在scala中的application.conf中添加多个额外的conf文件

时间:2015-04-24 11:51:34

标签: scala configuration akka

您好我正在尝试创建其他conf文件并将它们包含在application.conf中但是当我尝试从第二个conf文件中获取值时出现此错误

OpenAuth.AuthenticationClients.AddGoogle();

这是我的application.conf文件

com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'directUserReadMongoActor-dispatcher'
com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'directUserReadMongoActor-dispatcher'

这是我的第一个名为&#34的文件; DirectUserWriteMongoActor"

include "DirectUserWriteMongoActor"
include "DirectUserReadMongoActor"

akka {
   loggers = ["akka.event.slf4j.Slf4jLogger"]
   loglevel = "DEBUG"

}

这是我的第二个conf文件" DirectUserReadMongoActor"

akka {
  actor{

    ############################### Setting for a Router #####################################              
    directUserWritwMongoActor-dispatcher {
     # Dispatcher is the name of the event-based dispatcher
         type = Dispatcher
  # What kind of ExecutionService to use
    executor = "fork-join-executor"
  # Configuration for the fork join pool
  fork-join-executor {
    # Min number of threads to cap factor-based parallelism number to
    parallelism-min = 2
    # Parallelism (threads) ... ceil(available processors * factor)
    parallelism-factor = 2.0
    # Max number of threads to cap factor-based parallelism number to
    parallelism-max = 10
  }
  # Throughput defines the maximum number of messages to be
  # processed per actor before the thread jumps to the next actor.
  # Set to 1 for as fair as possible.
  throughput = 10         
                  } #end default-dispatcher 
     ############################### Setting for a Router #####################################              
     deployment{
     /directUserWritwMongoActorRouter{
     router = round-robin
     nr-of-instances = 5
     }
     }#end deployment

   }  #end Actor
}  #end Akka   

这是我在scala对象中的代码

akka {
  actor{
    ############################### Setting for a Router #####################################              
    directUserReadMongoActor-dispatcher {
     # Dispatcher is the name of the event-based dispatcher
         type = Dispatcher
  # What kind of ExecutionService to use
    executor = "fork-join-executor"
  # Configuration for the fork join pool
  fork-join-executor {
    # Min number of threads to cap factor-based parallelism number to
    parallelism-min = 2
    # Parallelism (threads) ... ceil(available processors * factor)
    parallelism-factor = 2.0
    # Max number of threads to cap factor-based parallelism number to
    parallelism-max = 10
  }
  # Throughput defines the maximum number of messages to be
  # processed per actor before the thread jumps to the next actor.
  # Set to 1 for as fair as possible.
  throughput = 10         
                  } #end default-dispatcher 
     ############################### Setting for a Router #####################################              
     deployment{
     /directUserReadMongoActorRouter{
     router = round-robin
     nr-of-instances = 5
     }
     }#end deployment

   }  #end Actor
}  #end Akka       

问题出现在第二val config = ConfigFactory.load().getConfig("akka.actor") println("throughput is "+config.getString("directUserWritwMongoActor-dispatcher.throughput")) println("throughput is of read "+config.getString("directUserReadMongoActor-dispatcher.throughput")) 行中,当我对第二行println行进行评论时,println的值已成功显示,但directUserWritwMongoActor-dispatcher.throughput未显示

我想打印这两个值,请帮助我在哪里做错了

0 个答案:

没有答案