Writing a test case would be awesome. Good travels! Anatole

ajs6f <[email protected]> schrieb am Fr., 19. Okt. 2018, 02:11:

> Glad to: https://issues.apache.org/jira/browse/TAMAYA-358
>
> I hope that is clear-- let me know if not. I can try to write a test case.
> (Traveling for the next week or so, so after that.)
>
> ajs6f
>
> > On Oct 18, 2018, at 7:56 PM, Anatole Tresch <[email protected]> wrote:
> >
> > I consider this is a bug, can you file one ? Would be awesome !
> >
> > Am Fr., 19. Okt. 2018 um 01:04 Uhr schrieb ajs6f <[email protected]>:
> >
> >> I'm afraid that didn't quite work (no change in behavior).
> >>
> >> Did I correctly understand you to mean this?
> >>
> >>    @Inject
> >>    @Config(value = { "trellis.configFile", "TRELLIS_CONFIG_FILE" })
> >>    private Optional<File> configFile;
> >>
> >> I've also tried it with required=false:
> >>
> >>    @Inject
> >>    @Config(value = { "trellis.configFile", "TRELLIS_CONFIG_FILE" },
> >> required = false)
> >>    private Optional<File> configFile;
> >>
> >> with the same behavior...
> >>
> >> ajs6f
> >>
> >>> On Oct 18, 2018, at 6:02 PM, Anatole Tresch <[email protected]>
> wrote:
> >>>
> >>> 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
> >>>>
> >>>>
> >>
> >>
> >
> > --
> > *Anatole Tresch*
> > PPMC Member Apache Tamaya
> > JCP Star Spec Lead
> > *Switzerland, Europe Zurich, GMT+1*
> > *maketechsimple.wordpress.com <http://maketechsimple.wordpress.com/> *
> > *Twitter:  @atsticks, @tamayaconf*
> >
> > *Speaking at:*
> >
> >  [image: JSD_Speaker_2017][image: J-Con 2017 logo][image: JVM Con]
>
>

Reply via email to