You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Polar Humenn <ph...@iona.com> on 2007/06/14 00:33:06 UTC

Spring Anomally

I have problem:

In a spring configuration file I'm trying to innitialize a Boolean property

          <bean class="....">
             <property name="enabled" value="true"/>
           </bean>

I always get:

org.springframework.beans.TypeMismatchExceptions: Failed to convert 
property value of type [java.lang.String] to required type [boolean] for 
proerty 'enabled'.

The signature of the property is:

public void setEnabled(java.lang.Boolean arg0);

in some JAXB generated code;

I had thought Spring had some default property editor, and the reference 
says so, (i.e. CustomBooleanPropertyEditor) that it just does these 
conversions automatically by default.

Has this conversion (property editor) been turned off or disabled in CXF 
anywhere?

Anybody have an answer, workaround, or a clue for me?

Cheers,
-Polar

Re: Spring Anomally

Posted by Fred Dushin <fr...@dushin.net>.
There are also issues with JAX-B generated primitive types (like  
Booleans), if you specify default values in the source schema.  In  
particular, the JAX-B generated types are not spring-compatible (I  
think they are not beans, proper).

I've worked around these issues by not defining defaults for  
primitive types in schema, but instead relying on code and  
documentation to enforce default behavior.  Not ideal, but it got me  
over that particular hump.

-Fred

On Jun 13, 2007, at 7:07 PM, Dan Diephouse wrote:

> I think this has to do with JAXB generating non-standard javabeans  
> - i.e.
> isetFoo(Boolean)/Boolean isFoo() - wheras the javabean spec would  
> require
> setFoo(Boolean)/Boolean getFoo(). Try adding a Boolean getEnabled()  
> and see
> if it works.
>
> - Dan
>
> On 6/13/07, Polar Humenn <ph...@iona.com> wrote:
>>
>> I have problem:
>>
>> In a spring configuration file I'm trying to innitialize a Boolean
>> property
>>
>>           <bean class="....">
>>              <property name="enabled" value="true"/>
>>            </bean>
>>
>> I always get:
>>
>> org.springframework.beans.TypeMismatchExceptions: Failed to convert
>> property value of type [java.lang.String] to required type  
>> [boolean] for
>> proerty 'enabled'.
>>
>> The signature of the property is:
>>
>> public void setEnabled(java.lang.Boolean arg0);
>>
>> in some JAXB generated code;
>>
>> I had thought Spring had some default property editor, and the  
>> reference
>> says so, (i.e. CustomBooleanPropertyEditor) that it just does these
>> conversions automatically by default.
>>
>> Has this conversion (property editor) been turned off or disabled  
>> in CXF
>> anywhere?
>>
>> Anybody have an answer, workaround, or a clue for me?
>>
>> Cheers,
>> -Polar
>>
>
>
>
> -- 
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog


Re: Spring Anomally

Posted by Dan Diephouse <da...@envoisolutions.com>.
I think this has to do with JAXB generating non-standard javabeans - i.e.
isetFoo(Boolean)/Boolean isFoo() - wheras the javabean spec would require
setFoo(Boolean)/Boolean getFoo(). Try adding a Boolean getEnabled() and see
if it works.

- Dan

On 6/13/07, Polar Humenn <ph...@iona.com> wrote:
>
> I have problem:
>
> In a spring configuration file I'm trying to innitialize a Boolean
> property
>
>           <bean class="....">
>              <property name="enabled" value="true"/>
>            </bean>
>
> I always get:
>
> org.springframework.beans.TypeMismatchExceptions: Failed to convert
> property value of type [java.lang.String] to required type [boolean] for
> proerty 'enabled'.
>
> The signature of the property is:
>
> public void setEnabled(java.lang.Boolean arg0);
>
> in some JAXB generated code;
>
> I had thought Spring had some default property editor, and the reference
> says so, (i.e. CustomBooleanPropertyEditor) that it just does these
> conversions automatically by default.
>
> Has this conversion (property editor) been turned off or disabled in CXF
> anywhere?
>
> Anybody have an answer, workaround, or a clue for me?
>
> Cheers,
> -Polar
>



-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog