Skip to content

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

Closed
@spring-projects-issues

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions