[ https://issues.apache.org/jira/browse/MYFACES-4340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17137913#comment-17137913 ]
Thomas Andraschko commented on MYFACES-4340: -------------------------------------------- JFYI: the code was a bit unclear in 2.3.x and i completely refactored it in trunk (2.3-next) it would be great if you could give 2.3.next a try (checkit in github and do a mvn clean install -DskipTests - we need to release the newer version soon), to check if its fixed there. > Managed converter can not be injected into other CDI bean > --------------------------------------------------------- > > Key: MYFACES-4340 > URL: https://issues.apache.org/jira/browse/MYFACES-4340 > Project: MyFaces Core > Issue Type: Bug > Affects Versions: 2.3.6 > Reporter: Jan Krpata > Priority: Major > > If CDI bean injects a managed converter with @FacesConverter @Qualifier, > AmbiguousResolutionException will be thrown > > {code:java} > org.apache.webbeans.exception.WebBeansDeploymentException: > javax.enterprise.inject.AmbiguousResolutionException: There is more than one > Bean with type cz.krpata.jsf23.UserConverter Qualifiers: > [@javax.faces.convert.FacesConverter(value=, forClass=class > cz.krpata.jsf23.User, managed=true)] > for injection into Field Injection Point, field name : userConverter, Bean > Owner : [InjectConverterIntoBean, WebBeansType:MANAGED, > Name:injectConverterIntoBean, API > Types:[cz.krpata.jsf23.InjectConverterIntoBean,java.lang.Object], > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named]] > found beans: > UserConverter, WebBeansType:THIRDPARTY, Name:null, API > Types:[cz.krpata.jsf23.UserConverter,java.lang.Object], > Qualifiers:[javax.enterprise.inject.Any,javax.faces.convert.FacesConverter] > from > file:/C:/Users/krpata/eclipse-2020-03-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp4/wtpwebapps/PFCsvTest-myfaces/WEB-INF/classes/cz/krpata/jsf23/UserConverter.class > UserConverter, WebBeansType:MANAGED, Name:null, API > Types:[cz.krpata.jsf23.UserConverter,java.lang.Object,javax.faces.convert.Converter<cz.krpata.jsf23.User>], > Qualifiers:[javax.enterprise.inject.Any,javax.faces.convert.FacesConverter] > from > file:/C:/Users/krpata/eclipse-2020-03-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp4/wtpwebapps/PFCsvTest-myfaces/WEB-INF/classes/cz/krpata/jsf23/UserConverter.class > {code} > > Dependencies: > * MyFaces 2.3.6 > * CDI (OWB) 2.0.14 > Classes: > > {code:java} > @FacesConverter(forClass=User.class, managed = true) > public class UserConverter implements Converter<User> { @Inject > private UserDAO userDAO; > > @Override > public User getAsObject(final FacesContext facesContext, final > UIComponent uiComponent, final String name) { > return userDAO.getUserByName(name); > } > @Override > public String getAsString(final FacesContext facesContext, final > UIComponent uiComponent, final User user) { > return user.getFirstname() + " " + user.getSurname(); > } > } > {code} > {code:java} > @RequestScoped > @Named > public class InjectConverterIntoBean { > > @Inject > @FacesConverter(forClass=User.class, managed = true) > private UserConverter userConverter; > ... > } > {code} > > -- This message was sent by Atlassian Jira (v8.3.4#803005)