Closed rocketraman closed 2 months ago
👍🏻
I am using the library's snapshot version, this MR might have changed the behavior of the library. Nothing has changed on the app side of the code but, now I get an error on runtime while booting the app.
I am using with yaml, and the error source of the hoplite report is with command line args.
Example:
server:
port: 8080
host: localhost
app:
kafka:
bootstrap-servers: localhost:9092
interceptorClasses: [ ]
autoOffset: Earliest
autoCreateTopics: true
consume:
group-id: app_name
heartbeat-interval: 2s
enabled: true
consumers:
AConsumer:
group-id: 123
topic: a-topic
retry: a-topic-retry
dead-letter: a-topic-error
CommandLineArgs also provide a new consumer configurations that are not in the application.yaml file (defined as resource to hoplite):
--app.kafka.consume.consumers.NewConsumer.topic=abc
--app.kafka.consume.consumers.NewConsumer.retry=abc2
// so on
Hoplite reports as "topic
was absent", which is also the only property that does not have a default value on the data class.
So, I am not sure what is the problem, or how it appears but behavior was affected. I now changed the library to the stable 2.7.5 version and it works.
I am using the library's snapshot version, this MR might have changed the behavior of the library.
@osoykan Thank you for the report. Is it possible for you to create a small reproduction in a project or unit test?
@rocketraman here you can find: https://github.com/osoykan/hoplite/commit/96378f0d6df1139ae4adcb4fd7caf0ecceb44d7f
@osoykan Thank you so much for raising this issue and creating a reproduction. I've found two related issues, and documented them here: https://github.com/sksamuel/hoplite/issues/443.
@sksamuel the fix for this regression is in PR https://github.com/sksamuel/hoplite/pull/444.
Thanks a lot for solving it!
Modify
ConfigLoader
andConfigParser
so that the config is parsed only a single time.ConfigLoader.configBinder()
can now be called to obtain the instance of a new classConfigBinder
, which can in turn be used to bind the already parsed config to multiple data classes, given a prefix.This follows the general approach as suggested by @cloudshiftchris.