Results 1 to 3 of 3

Thread: Strange problems with command bean post processing

  1. #1
    Join Date
    Aug 2005
    Location
    Austin, TX
    Posts
    425

    Default Strange problems with command bean post processing

    I'm trying to configure some of my commands using a PropertyPlaceholderConfigurer, but the beans defined in my commands-context.xml never seem to get processed.

    I'm assuming it has to do with the fact that the beans are not loaded directly into the application context, but instead are loaded as a property on the lifeycle advisor.

    Is this behavior intentional? Because it seems counter-intuitive. I would have expected the bean definitions to receive all the normal processing that any other spring bean receives.

    Anyway, is there any way to accomplish what I'm trying to do?

    Thanks,
    Larry.

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    335

    Default

    Quote Originally Posted by lstreepy
    I'm trying to configure some of my commands using a PropertyPlaceholderConfigurer, but the beans defined in my commands-context.xml never seem to get processed.

    I'm assuming it has to do with the fact that the beans are not loaded directly into the application context, but instead are loaded as a property on the lifeycle advisor
    Yep - this is correct. For some unknown reason commands are loaded using a BeanFactory rather than an ApplicationContext (which allows for automatic registration of post processes etc).

    There's probably 2 ways you could try to fix this. 1) replace the usage of a bean factory with an app context. Ideally this "command context" would be a child of the main application context used to configure application services. 2) add another method to DefaultApplicationLifecycleAdvisor#initNewWindowCo mmandBarFactory which registers all of the BeanFactoryPostProcessors found in the command bean factory. This would be similar to the registerBeanPostProcessors method but for BeanFactoryPostProcessors. You'd also need to dumplicate your PropertyPlaceholderConfigurer config in the command bean factory defintion.

    HTH

    Ollie

  3. #3
    Join Date
    Aug 2005
    Location
    Austin, TX
    Posts
    425

    Default

    Thanks Ollie, that's pretty much the conclusion that I had come to. What I was wondering is if anyone knew why the original implementation went to so much trouble to use a BeanFactory instead of an ApplicaitonContext.

    Anyway, I've got a version working with an ApplicationContext and it seems to work well. The only real visible change is that the commands context file would no longer be a Resource, it would be a string that is used as a normal ApplicationContext "location".

    Let me know if you see a reason NOT to pursue changing to an ApplicationContext.

    Thanks.
    Larry.

Similar Threads

  1. Post processing with the ContextLoaderListener
    By dres1011 in forum Container
    Replies: 0
    Last Post: Aug 18th, 2005, 01:55 PM
  2. Replies: 3
    Last Post: May 16th, 2005, 07:04 AM
  3. Channel and message transformation question
    By Alarmnummer in forum Architecture
    Replies: 12
    Last Post: May 11th, 2005, 05:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •