|
From: Eduardo I. I. <zi...@su...> - 2004-03-05 19:22:07
|
Chris Winters wrote:
> Plus I'm not sure how to do this from an ApplicationContext vs. a
> BeanFactory -- the registerCustomEditor() seems to be implemented in
> AbstractBeanFactory which doesn't seem to be a parent of any
> ApplicationContext class. (I'm a little hazy on the relationships among
> the objects at this level tho.)
As the CustomEditorConfigurer object implements BeanFactoryPostProcessor it will
be automatically called by the ApplicationContext and the custom editors will be
configured. So you can just declare the bean in the xml file and thats all.
If you are using just a BeanFactory it will no work and you will have to do
something like:
CustomEditorConfigurer c = new CustomEditorConfigurer();
c.setWhatever(..);
c.postProcessBeanFactory(beanFactory);
It raised me a question: what will happen if I do
CustomEditorConfigurer c = beanFactory.getBean("customEditorConfigurer");
c.postProcessBeanFactory(beanFactory);
Is it possible to register a post processor this way?
|