1 Reply Latest reply on May 5, 2010 11:40 AM by sappo

    Injection in a Converter

    christine1
      I have a custom converter that needs to read data from a database in order to get an object for a string.This is my code:

      @Name("countryConverter")
      public class CountryConverter implements javax.faces.convert.Converter {

          @In
          private CountryDao countryDao;
      ...

      But the CountryDao doesn't get injected. I also tried

      @Converter(id=countryConverter)
      @BypassInterceptors
      public class ...

      but that didn't work either. Am I missing something? We use jboss-seam-2.2.1.CR1


        • 1. Re: Injection in a Converter
          sappo

          Hi xtine,


          seam injection and outjection is provided by interceptor methods and because converters have to be annotated with @BypassInterceptors injection doesn't work. But there is a legal workaround:


          countryDao = (CountryDao) Component.getInstance("componentsNameOfCountryDao");