myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Nicolucci (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (MYFACES-4130) CDI @ManagedProperty does not work with all types
Date Wed, 02 Aug 2017 20:03:00 GMT

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

Paul Nicolucci commented on MYFACES-4130:
-----------------------------------------

I've been able to modify a test I had to fit in the myfaces unit test framework. I had to
make some updates to the el dependency used for testing. I'll leave the patch here until tomorrow
and then will work to commit it if no comments.

> CDI @ManagedProperty does not work with all types
> -------------------------------------------------
>
>                 Key: MYFACES-4130
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4130
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-372
>    Affects Versions: 2.3.0-beta
>            Reporter: Paul Nicolucci
>            Assignee: Paul Nicolucci
>         Attachments: MYFACES-4130.patch, MYFACES-4130-with-test.patch
>
>
> CDI Replacement for @ManagedProperty does not work with primitives, 
> ParameterizedType or arrays.
> For example:
> @Inject
> @ManagedProperty("#{testBean.list}")
> private List<String> listManagedProperty;
> javax.faces.FacesException: java.lang.ClassNotFoundException: java.util.List<java.lang.String>
> 	at org.apache.myfaces.shared.util.ClassUtils.simpleClassForName(ClassUtils.java:218)
> 	at org.apache.myfaces.cdi.bean.DynamicManagedPropertyProducer.<init>(DynamicManagedPropertyProducer.java:58)
> 	at org.apache.myfaces.cdi.bean.ManagedPropertyExtension.afterBean(ManagedPropertyExtension.java:62)
> @Inject
> @ManagedProperty("#{testBean.number}")
> private int numberManagedProperty;
> javax.faces.FacesException: java.lang.ClassNotFoundException: int
> 	at org.apache.myfaces.shared.util.ClassUtils.simpleClassForName(ClassUtils.java:218)
> 	at org.apache.myfaces.cdi.bean.DynamicManagedPropertyProducer.<init>(DynamicManagedPropertyProducer.java:58)
> 	at org.apache.myfaces.cdi.bean.ManagedPropertyExtension.afterBean(ManagedPropertyExtension.java:62)
> @Inject
> @ManagedProperty("#{testBean.stringArray}")
> private String[] stringArrayManagedProperty;
> javax.faces.FacesException: java.lang.ClassNotFoundException: java.lang.String[]
> 	at org.apache.myfaces.shared.util.ClassUtils.simpleClassForName(ClassUtils.java:218)
> 	at org.apache.myfaces.cdi.bean.DynamicManagedPropertyProducer.<init>(DynamicManagedPropertyProducer.java:58)
> 	at org.apache.myfaces.cdi.bean.ManagedPropertyExtension.afterBean(ManagedPropertyExtension.java:62)
> I've attached a patch. If no objections by Wednesday close of business I'll commit it.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message