我使用Akka HTTP库创建了一个HTTP服务器。我想在application.conf
中指定默认的http端口,以覆盖reference.conf
中的默认端口。在application.conf中:
akka {
http.server.default-http-port = 8081
# ...
}
并且我将http服务器创建为
// I don't specify the port here explicitly
val serverSource = Http().bind(interface = "localhost")
我假设如果未在bind
方法中指定端口,则Akka http服务器将使用application.conf
中的设置。但事实并非如此。如果我还有其他需要覆盖的HTTP服务器设置怎么办?这是预期的行为,还是我做错了什么?
尝试不使用server
:
akka {
http.default-http-port = 8081
# ...
}