Uploaded image for project: 'Tamaya'
  1. Tamaya
  2. TAMAYA-358

No way to inject an optional config value via CDI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.3-incubating
    • 0.4-incubating
    • None

    Description

      It's not possible to use @Config to inject an optional value in a CDI project. None of the following work:

          @Inject
          @Config(value = { "trellis.configFile", "TRELLIS_CONFIG_FILE" }, required=false)
          private File configFile;
      
          @Inject
          @Config(value = { "trellis.configFile", "TRELLIS_CONFIG_FILE" }, required=false)
          private Optional<File> configFile;
      
          @Inject
          @Config(value = { "trellis.configFile", "TRELLIS_CONFIG_FILE" })
          private Optional<File> configFile;
      

      All throw a

      org.apache.tamaya.ConfigException: Cannot resolve any of the possible configuration keys: [trellis.configFile, TRELLIS_CONFIG_FILE]. Please provide one of the given keys with a value in your configuration sources.
      

      Attachments

        Issue Links

          Activity

            People

              anatole Anatole Tresch
              ajs6f Adam Soroka
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: