In spring is possible to define scoped proxy bens as described here:
@Service
@SessionScope(proxyMode = ScopedProxyMode.TARGET_CLASS)
public class MyBeanClass {
// ...
}
I really would love to do the same thing programatically, e.g. when registering a bean with an ApplicationContextInitializer.
public class MyInitializer implements
ApplicationContextInitializer<GenericWebApplicationContext> {
@Override
public void initialize(GenericWebApplicationContext applicationContext) {
applicationContext.registerBean(MyBeanClass.class, beanDefinitionCustomizer -> ....);
}
}
Is this possible? I haven't found any public API to do so...