Guice and general application configuration

前端 未结 4 1773
时光说笑
时光说笑 2021-02-04 01:30

For a monitoring software written in Java I consider using Google Guice as DI provider. The project needs to load its configuration from an external resource (file or database).

4条回答
  •  鱼传尺愫
    2021-02-04 02:24

    Check the governator library:

    https://github.com/Netflix/governator/wiki/Configuration-Mapping

    You will get a @Configuration annotation and several configuration providers. In code it helps to see where is You configuration parameters used:

    @Configuration("configs.qty.things")
    private int   numberOfThings = 10;
    

    Also, You will get a nice configuration report on startup:

    https://github.com/Netflix/governator/wiki/Configuration-Mapping#configuration-documentation

提交回复
热议问题