the problem is that CDI dies not support optional values in this way, this
works in a non cdi env e.g. Spring, osgi.... What should work is injecting
an Optional<File>.

ajs6f <[email protected]> schrieb am Do., 18. Okt. 2018, 17:51:

> Hi, Tamaya folks!
>
> I just tried using the required=false attribute of
> o.a.t.inject.api.Config, on a field, with a CDI project, a la:
>
> @Inject
> @Config(value = { "trellis.configFile", "TRELLIS_CONFIG_FILE" }, required
> = false)
> private File configFile;
>
> Unfortunately, it didn't seem to make the value truly optional. I got the
> expectable:
>
> 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.
>
> Is required=false supported in that position, or am I misunderstanding its
> semantics?
>
> Thanks!
>
> ajs6f
>
>

Reply via email to