Announcement Announcement Module
Collapse
No announcement yet.
TypeMismatchException - java.lang.Character Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • TypeMismatchException - java.lang.Character

    I'm attempting to configure a bean within spring using the following bean definition where 'entryIndicator' is defined as a java.lang.Character instance variable on com.test.EntryBean, with the necessary getter/setter:

    <bean id="docTypeBean0" class="com.test.EntryBean">
    <property name="entryIndicator">
    <value>Y</value>
    </property>
    </bean>

    Although, when loading this context file into the ApplicationContext, I am receiving the exception:

    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [java.lang.Character] for property 'entryIndicator'

    Any ideas how I can explicitly define 'entryIndicator' as a java.lang.Character rather than a String?

  • #2
    As far as I am aware there is no PropertyEditor in Spring for doing this nor is there default suppotrt by JavaBeans. You can create your own PropertyEditor and then register it with CustomEditorConfigurer.

    Check the JavaDocs for CustomEditorConfigurer and have a look at the code for some of the PropertyEditor supplied with Spring.

    Rob

    Comment

    Working...
    X