Skip to content

Calls to FactoryBean @Bean methods cause ClassCastException [SPR-6602] #11268

Closed
@spring-projects-issues

Description

@spring-projects-issues

Liu, Yinwei David opened SPR-6602 and commented

Hi,
It looks like that the javaconfig in Spring 3 does not support configure a FactoryBean in javaconfig, and then easily inject it to another Bean.

What I want in Spring 3 java config is:
class MyFactoryBean implements FactoryBean<B>{}

@Bean
public MyFactoryBean bFactoryBean() {
    return new MyFactoryBean();
}

@Bean
public A a(B b) {
    A a = new A();
    a.setB( bFactoryBean().getObject() );
    return a;
}

Can Spring 3 support FactoryBean in its javaconfig?


Affects: 3.0 GA

Attachments:

Issue Links:

Referenced from: commits 4c05eae

1 votes, 1 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions