Skip to content

No way to retrieve the actual target type using beanName [SPR-12704] #17301

Closed

Description

@spring-projects-issues

Stéphane Nicoll opened SPR-12704 and commented

ApplicationContext#getType(String beanName) returns the Class<?> of the bean exposed with the specified name.

When the bean is wrapped in a proxy, it returns the class of the proxy which does not help much. The way to workaround that for the moment is to get the bean instance (getBean(beanName) and use AopUtils.getTargetClass() with the result. Unfortunately the whole point of calling getType is to use the meta-data of the bean factory and not early initialize the bean instance.

It would be nice if the target type would be exposed as well.


Issue Links:

1 votes, 3 watchers

Activity

  1. added
    status: waiting-for-triage
    type: enhancement
    and removed
    type: enhancement
    on Jan 11, 2019
  2. added
    status: bulk-closed
    and removed
    status: bulk-closed
    status: waiting-for-triage
    on Jan 11, 2019
  3. spring-projects-issues commented on Jan 12, 2019

    @spring-projects-issues
    CollaboratorAuthor

    Bulk closing outdated, unresolved issues. Please, reopen if still relevant.

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

    status: bulk-closed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions