在原型中注入spring javaconfig原型

时间:2018-11-20 09:49:52

标签: spring spring-java-config

我有两个原型Spring bean,定义如下:

@Bean
@Scope("prototype")
public Type1 type1(Type2 type2 ){
    return new Type1 (type2 );
}

@Bean
@Scope("prototype")
public Type2 type2 (){
    return new Type2();
}

当我执行类似appContext.getBean("type1");的操作时,每次执行getBean都会创建Type1和Type2的新实例吗。

0 个答案:

没有答案
相关问题