Ktor 0.9.3 导入其他配置文件抛出异常
Importing another configuration file in Ktor 0.9.3 throws exception
在 Ktor 0.9.3 应用程序中,我想为不同的环境使用不同的 .conf
文件,我扩展了一个主要的 .conf
文件。但是,我收到以下异常:
Exception in thread "main" com.typesafe.config.ConfigException$NotResolved: called valueType() on value with unresolved substitutions, need to Config#resolve() first, see API docs
at com.typesafe.config.impl.ConfigDelayedMerge.valueType(ConfigDelayedMerge.java:46)
at com.typesafe.config.impl.SimpleConfig.hasPath(SimpleConfig.java:96)
at io.ktor.config.HoconApplicationConfigKt.tryGetString(HoconApplicationConfig.kt:33)
at io.ktor.server.engine.CommandLineKt$commandLineEnvironment$environment.invoke(CommandLine.kt:64)
at io.ktor.server.engine.CommandLineKt$commandLineEnvironment$environment.invoke(CommandLine.kt)
at io.ktor.server.engine.ApplicationEngineEnvironmentBuilder.build(ApplicationEngineEnvironment.kt:55)
at io.ktor.server.engine.ApplicationEngineEnvironmentKt.applicationEngineEnvironment(ApplicationEngineEnvironment.kt:38)
at io.ktor.server.engine.CommandLineKt.commandLineEnvironment(CommandLine.kt:50)
at io.ktor.server.netty.DevelopmentEngine.main(DevelopmentEngine.kt:13)
at ApplicationKt.main(application.kt:24)
这是我的 application.conf
文件:
ktor {
deployment {
port = 8080
port = ${?PORT}
watch = [ website ]
}
application {
modules = [ ApplicationKt.module ]
}
}
ui {
hotreload {
enabled = false
path-prefix = "http://localhost:3000"
}
}
以及我想使用的扩展:
include "application.conf"
ui.hotreload.enabled = true
知道哪里出了问题以及如何解决吗?
根据我在 Ktor's GitHub page, this is a known bug for which a PR fixing it 上打开的问题已经合并,因此应该在下一个版本中修复。事实上,它在版本 0.9.4-alpha-2
中按预期工作
在 Ktor 0.9.3 应用程序中,我想为不同的环境使用不同的 .conf
文件,我扩展了一个主要的 .conf
文件。但是,我收到以下异常:
Exception in thread "main" com.typesafe.config.ConfigException$NotResolved: called valueType() on value with unresolved substitutions, need to Config#resolve() first, see API docs
at com.typesafe.config.impl.ConfigDelayedMerge.valueType(ConfigDelayedMerge.java:46)
at com.typesafe.config.impl.SimpleConfig.hasPath(SimpleConfig.java:96)
at io.ktor.config.HoconApplicationConfigKt.tryGetString(HoconApplicationConfig.kt:33)
at io.ktor.server.engine.CommandLineKt$commandLineEnvironment$environment.invoke(CommandLine.kt:64)
at io.ktor.server.engine.CommandLineKt$commandLineEnvironment$environment.invoke(CommandLine.kt)
at io.ktor.server.engine.ApplicationEngineEnvironmentBuilder.build(ApplicationEngineEnvironment.kt:55)
at io.ktor.server.engine.ApplicationEngineEnvironmentKt.applicationEngineEnvironment(ApplicationEngineEnvironment.kt:38)
at io.ktor.server.engine.CommandLineKt.commandLineEnvironment(CommandLine.kt:50)
at io.ktor.server.netty.DevelopmentEngine.main(DevelopmentEngine.kt:13)
at ApplicationKt.main(application.kt:24)
这是我的 application.conf
文件:
ktor {
deployment {
port = 8080
port = ${?PORT}
watch = [ website ]
}
application {
modules = [ ApplicationKt.module ]
}
}
ui {
hotreload {
enabled = false
path-prefix = "http://localhost:3000"
}
}
以及我想使用的扩展:
include "application.conf"
ui.hotreload.enabled = true
知道哪里出了问题以及如何解决吗?
根据我在 Ktor's GitHub page, this is a known bug for which a PR fixing it 上打开的问题已经合并,因此应该在下一个版本中修复。事实上,它在版本 0.9.4-alpha-2