Announcement Announcement Module
Collapse
No announcement yet.
Can't register my Converter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can't register my Converter

    I'm following the example <a href="http://static.springsource.org/spring/docs/3.0.7.RELEASE/reference/validation.html#core-convert">here</a>.

    My applicationContext has the following:

    <bean id="conversionService"
    class="org.springframework.context.support.Convers ionServiceFactoryBean">
    <property name="converters">
    <set>
    <bean class="org.mypackage.MyFilterConverter"/>
    </set>
    </property>
    </bean>

    My converter looks like this:

    public class MyFilterConverter implements Converter<String, HashMap<String, List<MyClass>>> { ...

    The converter does not get registered. I tested MyFilterConverter independently and it works.


    I followed the stack trace down to GenericConversionService.getMatchableConverters(Cl ass<?> sourceType, Class<?> targetType). It seems to me that the bug is that the matchable is not added to anything. Anyway, I wasn't able to follow the code through, but it looks like there's where the thing gets lost.

    When I come back from this call, my converter is not added.

    Any ideas?

    thanks

    --
    llappall

  • #2
    Hello

    1) Next time use code tags
    2) Post the complete error stack trace to analyze it

    Comment


    • #3
      First of all I can see the space between "Convers" and "ionServiceFactoryBean" . is that ok?
      Second what us your Converter interface? better to use "org.springframework.core.convert.converter.Generi cConverter" interface

      There are Two method signature in CustomConverter Class
      1) Set<ConvertiblePair> getConvertibleTypes()

      this method will get involved once at initialroading
      and make decision pair of conversion type for calling back later

      2)Object convert(Object source, TypeDescriptor sourceType,
      TypeDescriptor targetType)


      This method will calling back every time for proper matching

      Comment

      Working...
      X