Hans Desmet opened SPR-14832 and commented
Add a registerBean method to ApplicationContext which accepts a lambda with which you register as bean.
The following code uses this method to register a bean of a class A and to register a
bean of class B which has a dependency on class A
@Configuration
public class MyConfiguration
private final ApplicationContext context;
public MyConfiguration(ApplicationContext context) {
this.context = context;
context.registerBean(AClass.class -> new AClass());
context.registerBean(BClass.class -> new BClass(context.getBean(AClass.class));
}
Affects: 5.0 M2
Issue Links:
1 votes, 8 watchers
Hans Desmet opened SPR-14832 and commented
Add a registerBean method to ApplicationContext which accepts a lambda with which you register as bean.
The following code uses this method to register a bean of a class A and to register a
bean of class B which has a dependency on class A
Affects: 5.0 M2
Issue Links:
@Configurationinterface with Java 8 default methods (as a standalone artifact)1 votes, 8 watchers