Results 1 to 8 of 8

Thread: Custom property editor doesn't fire in new version of spring

Hybrid View

  1. #1
    Join Date
    Oct 2007
    Posts
    5

    Default Custom property editor doesn't fire in new version of spring

    I have an application context and registered custom editor.
    When application starts and bean factory is initialized custom editor is called for bean creation but when later in application i create the bean with beanFactory.getBean("beanName") it is not called. spring-2.0 calls it in both cases. Is it a new feature or bug?

  2. #2

    Default

    Depends on your code

  3. #3
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    Is it possible to see what you were trying to do?
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  4. #4
    Join Date
    Oct 2007
    Posts
    5

    Default

    It is registered in the following way
    <bean class="org.springframework.beans.factory.config.Cu stomEditorConfigurer">
    <property name="customEditors">
    <map>
    <entry key="java.lang.String">
    <bean class="com.my.CustomEditor"/>
    </entry>
    </map>
    </property>
    </bean>
    Later the following code gets bean from context
    Object target = targetsMap.get(targetSelector);
    if (target == null) {
    target = beanFactory.getBean(targetName);
    }
    and editor fires only the first time.
    The bean is prototype. In spring-2.0.4 it fires but in 2.0.6 - no.
    Last edited by zaplitny; Oct 28th, 2007 at 07:51 AM.

  5. #5
    Join Date
    Oct 2007
    Posts
    5

    Default

    BeanWrapperImpl :

    spring-2.0.3 : Object convertedValue = this.typeConverterDelegate.convertIfNecessary(oldV alue, newValue, pd);

    spring-2.0.6 : Object convertedValue = (propertyValue.isConverted() ? pv.getConvertedValue() :
    this.typeConverterDelegate.convertIfNecessary(oldV alue, pv.getValue(),pd));

    propertyValues for bean with current name are taken from map, and when it is taken after bean creation, its propertyValue.converted = true
    It means that I cannot generate dynamic propertyValues with propertyEditor. Is there another way of doing this?

  6. #6
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    Quote Originally Posted by zaplitny View Post
    It means that I cannot generate dynamic propertyValues with propertyEditor.
    What does that mean? Where do you need/want dynamic property values? And in which way are they dynamic?

    You should also consider using PropertyEditorRegistrar.

    Joerg
    This post can contain insufficient information.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •