Skip to content

Regression - Introspection with BeanUtils started failing for java.math.BigDecimal [SPR-8931] #13571

Closed

Description

@spring-projects-issues

Dennis Kieselhorst opened SPR-8931 and commented

After updating from 3.0.6 to 3.1 the bean creation for java.math.BigDecimal fails with:

Caused by: org.springframework.beans.FatalBeanException: Failed to obtain BeanInfo for class [java.math.BigDecimal]; nested exception is java.beans.IntrospectionException: type mismatch between indexed and non-indexed methods: scale
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:262)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:149)
at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:324)
at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:331)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1242)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1101)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
... 149 more
Caused by: java.beans.IntrospectionException: type mismatch between indexed and non-indexed methods: scale
at java.beans.IndexedPropertyDescriptor.findIndexedPropertyType(IndexedPropertyDescriptor.java:341)
at java.beans.IndexedPropertyDescriptor.setIndexedWriteMethod(IndexedPropertyDescriptor.java:248)
at org.springframework.beans.ExtendedBeanInfo.addOrUpdatePropertyDescriptor(ExtendedBeanInfo.java:261)
at org.springframework.beans.ExtendedBeanInfo.<init>(ExtendedBeanInfo.java:142)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:224)
... 155 more


Affects: 3.1 GA

Issue Links:

Referenced from: commits 0ee1256, 4a8be69

Activity

  1. spring-projects-issues commented on Dec 15, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Dennis Kieselhorst commented

    Relates to #13137

  2. spring-projects-issues commented on Feb 13, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    This should now be resolved for the same reasons as #13137

  3. spring-projects-issues commented on Mar 1, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Aaron Digulla commented

    "Should" sounds ominous. Can you please add this test case?

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:p="http://www.springframework.org/schema/p"
           xmlns:context="http://www.springframework.org/schema/context"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
               http://www.springframework.org/schema/context
               http://www.springframework.org/schema/context/spring-context-3.0.xsd"
           default-autowire="byType"
           default-lazy-init="false">
    
        <bean id="ID_1" class="java.math.BigDecimal">
            <constructor-arg><value>1</value></constructor-arg>
        </bean>
    </beans>
    

    Not sure whether default-autowire and default-lazy-init have an impact.

  4. spring-projects-issues commented on Mar 1, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    Hey Aaron, I can appreciate your concern here. This actually does succeed just fine, take a look at this quick verification:

    https://github.com/cbeams/spring-framework/tree/SPR-8931

  5. spring-projects-issues commented on Jun 4, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Aaron Digulla commented

    Thanks, 3.1.1 works for me, now!

  6. spring-projects-issues commented on Nov 25, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    A general note to watchers of ExtendedBeanInfo-related issues: #14663 is a major refactoring of ExtendedBeanInfo and overall support for non-void returning setter methods.

    If you have submitted a reproduction project with this issue, we have run it through its paces against these new changes, but we would like to ask you to do the same against your actual applications.

    Please consider updating your dev or test builds to work against 3.1.4.BUILD-SNAPSHOT and/or 3.2.0.BUILD-SNAPSHOT to verify, and we would appreciate any feedback, even if it's to let us know that all is well. So that we can consolidate feedback, please add your comments to #14663, and mention the original issue(s) that you were watching.

    Thanks!

    Note also that testing against 3.1.4 is preferable to 3.2.0 because ExtendedBeanInfo is always in the code path in the latter, while in 3.2.0 we've optimized things such that ExtendedBeanInfo is only in play for bean classes that have one or more non-void returning setter methods.

  7. added
    type: bug
    in: core
    on Jan 11, 2019
  8. added this to the 3.1.1 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coretype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions