[ 
https://issues.apache.org/jira/browse/TAMAYA-358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16691057#comment-16691057
 ] 

ASF subversion and git services commented on TAMAYA-358:
--------------------------------------------------------

Commit bf0cd8b36a1a289f63911ac54305f5b91bff3dc7 in 
incubator-tamaya-extensions's branch refs/heads/master from [~anatole]
[ 
https://git-wip-us.apache.org/repos/asf?p=incubator-tamaya-extensions.git;h=bf0cd8b
 ]

TAMAYA-358 Merged patch from @peculator with existing improvements.


> No way to inject an optional config value via CDI
> -------------------------------------------------
>
>                 Key: TAMAYA-358
>                 URL: https://issues.apache.org/jira/browse/TAMAYA-358
>             Project: Tamaya
>          Issue Type: Bug
>    Affects Versions: 0.3-incubating
>            Reporter: A. Soroka
>            Assignee: Anatole Tresch
>            Priority: Minor
>              Labels: cdi, injection, optional
>
> It's not possible to use {{@Config}} to inject an optional value in a CDI 
> project. None of the following work:
> {code:java}
>     @Inject
>     @Config(value = { "trellis.configFile", "TRELLIS_CONFIG_FILE" }, 
> required=false)
>     private File configFile;
> {code}
> {code:java}
>     @Inject
>     @Config(value = { "trellis.configFile", "TRELLIS_CONFIG_FILE" }, 
> required=false)
>     private Optional<File> configFile;
> {code}
> {code:java}
>     @Inject
>     @Config(value = { "trellis.configFile", "TRELLIS_CONFIG_FILE" })
>     private Optional<File> configFile;
> {code}
> All throw a 
> {noformat}
> 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.
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to