Announcement Announcement Module
Collapse
No announcement yet.
Setter problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setter problem

    I can't initalize a property of one of my classes from the spring Xml file, i have this exception :

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name ' ... .DefaultEpargneParams#12412e7' defined in class path resource [application-def.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'TraitementBordure' of bean class [ ... .DefaultEpargneParams]: Bean property 'TraitementBordure' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?

    org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'TraitementBordure' of bean class [ ... .DefaultEpargneParams]: Bean property 'TraitementBordure' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?

    My xml :

    ...
    <bean class=" ... .DefaultEpargneParams">
    <property name="TraitementBordure">
    <value>2</value>
    </property>
    ...

    My classes :

    public class DefaultEpargneParams
    implements EpargneParams, Serializable
    {
    ...
    protected int traitementBordure = EpargneUtils.SANS_BORDURE;
    ...
    public int getTraitementBordure()
    {
    return traitementBordure;
    }
    ...
    public void setTraitementBordure(int traitementBordure)
    {
    this.traitementBordure = traitementBordure;
    }
    ...
    }

    public interface EpargneParams
    {
    ...
    public int getTraitementBordure();
    public void setTraitementBordure(int traitementBordure);
    ...
    }

    Can someone help me please ?

  • #2
    The JavaBean model has a special casing convention for property names: a setter called "setTraitementBordure" corresponds to a bean property of name "traitementBordure" - the first letter being lower case. So if you start that property name with a lower case "t", it should work.

    Juergen

    Comment


    • #3
      Originally posted by Juergen Hoeller
      The JavaBean model has a special casing convention for property names: a setter called "setTraitementBordure" corresponds to a bean property of name "traitementBordure" - the first letter being lower case. So if you start that property name with a lower case "t", it should work.

      Juergen
      Thanks a lot, migrating from .net and i forgot javabeans conventions.

      Comment

      Working...
      X