views:

421

answers:

1

I want to programmatically setup a FactoryBean on an existing ApplicationContext. There are a lot of examples on how to define a bean programmatically (e.g.: http://www.carlobonamico.com/blog/2008/01/22/how-to-dynamicallyprogrammatically-define-spring-beans/), but they do not work when I try to define a factory bean

A: 

The way you provided with the link given is exactly the way to go. For a BeanFactoryPostProcesser there is no difference between a class implementing FactoryBean or one that doesn't. All you typically do is register a BeanDefinition via BeanDefinitionRegistry.

Oliver Gierke