Skip to content

AbstractAutowireCapableBeanFactory.predictBeanType returns parent type instead of class="<real class>" value [SPR-10507] #15139

Closed

Description

@spring-projects-issues

pascal gehl opened SPR-10507 and commented

Introduction:
I have some code that used to work since 2-3 years.
I just moved from version 3.1.3.RELEASE to 3.2.2.RELEASE.
And suddenly it stopped working.

Here are my beans:

 
<bean id="abstractIsAliveResource" abstract="true" class="com.cie.isalive.server.rest.AbstractIsAliveResource">
      <property name="enabled" ref="isAliveEnabled" />
</bean>

<bean id="simpleIsAliveResource" parent="abstractIsAliveResource" class="com.cie.isalive.server.rest.SimpleIsAliveResource" />

<bean id="isAliveResource" parent="abstractIsAliveResource" class="com.cie.isalive.server.rest.IsAliveResource">
      <property name="showall" value="${status.isalive.showall}" />
</bean>

Both isAliveResource and simpleIsAliveResource are JAX-RS annotated classes.

@Path(IS_ALIVE_URI)
@Produces(APPLICATION_XML)
public class IsAliveResource extends AbstractIsAliveResource {
@Path(IS_SIMPLE_ALIVE_URI)
public class SimpleIsAliveResource extends AbstractIsAliveResource {

Somewhere else in my code I do:

Set<Object> resources = getApplicationContext().getBeansWithAnnotation(Path.class);

In 3.1.3.RELEASE both isAliveResource and simpleIsAliveResource where found.
Since moving to 3.2.2.RELEASE none of them are found.
I debugged and finally found that AbstractAutowireCapableBeanFactory.predictBeanType changed and now returns
com.cie.isalive.server.rest.AbstractIsAliveResource class instead of respective beans com.cie.isalive.server.rest.SimpleIsAliveResource and com.cie.isalive.server.rest.IsAliveResource.

Since AbstractIsAliveResource is not annotated then the beans are not found.

It is a major issue since we cannot use abstract beans for default annotated beans configuration anymore.

Thanks in advance.

Pascal


Affects: 3.2.2

Issue Links:

Activity

  1. added
    type: bug
    in: core
    on Jan 11, 2019
  2. added this to the 3.2.3 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

Labels

in: coretype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions