[jboss-jira] [JBoss JIRA] (WFWIP-63) ConfigProperty injection for Provider<CustomClass> is not working

Jeff Mesnil (JIRA) issues at jboss.org
Wed Jul 18 10:27:00 EDT 2018


    [ https://issues.jboss.org/browse/WFWIP-63?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13607621#comment-13607621 ] 

Jeff Mesnil commented on WFWIP-63:
----------------------------------

There was an issue in smallrye-config to inject Provider that is fixed by https://github.com/smallrye/smallrye-config/pull/14


> ConfigProperty injection for Provider<CustomClass> is not working
> -----------------------------------------------------------------
>
>                 Key: WFWIP-63
>                 URL: https://issues.jboss.org/browse/WFWIP-63
>             Project: WildFly WIP
>          Issue Type: Bug
>          Components: MP Config
>            Reporter: Rostislav Svoboda
>            Assignee: Jeff Mesnil
>            Priority: Critical
>
> ConfigProperty injection for Provider<CustomClass> is not working
> Using https://github.com/rsvoboda/rsvoboda-playground/tree/master/microprofile-config-custom-converter-and-source application.
> This is working on OpenLiberty, but not on WF server. TBH I don't see reason why this shouldn't be working on WF too.
> First I thought it's problem in convertor not being picked up properly, but the problem seems to be triggered by https://github.com/rsvoboda/rsvoboda-playground/blob/master/microprofile-config-custom-converter-and-source/src/main/java/org/experiments/rsvoboda/system/SystemConfig.java#L18
> WF throws following error when accessing http://localhost:8080/microprofile-config/config/properties
> {code}
> Caused by: org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001334: Unsatisfied dependencies for type Email with qualifiers @ConfigProperty
> 	at org.jboss.weld.bean.builtin.InstanceImpl.checkBeanResolved(InstanceImpl.java:241)
> 	at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:113)
> 	at org.experiments.rsvoboda.system.SystemConfig.getEmail(SystemConfig.java:26)
> {code}
> When I change the code to avoid javax.inject.Provider usage, things start to work as expected.
> {code}
> --- src/main/java/org/experiments/rsvoboda/system/SystemConfig.java	(date 1531917469000)
> +++ src/main/java/org/experiments/rsvoboda/system/SystemConfig.java	(date 1531917469000)
> @@ -15,7 +15,7 @@
>  
>      @Inject
>      @ConfigProperty(name = "io_openliberty_guides_email")
> -    private Provider<Email> email;
> +    private Email email;
>  
>  
>      public boolean isInMaintenance() {
> @@ -23,7 +23,7 @@
>      }
>  
>      public Email getEmail() {
> -        return email.get();
> +        return email;
>      }
>  
>  }
> {code}
> When trying the example please follow https://github.com/rsvoboda/rsvoboda-playground/blob/master/microprofile-config-custom-converter-and-source/README.md
> CustomConfigSource has to be adjusted.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list