Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Simple concept question: intercept multi-thread method?

  1. #11
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Just as addition to the solution described by Colin, see this thread. It also contains an example for the application context.

    Regards,
    Andreas

  2. #12
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    Quote Originally Posted by Andreas Senft
    Just as addition to the solution described by Colin, see this thread. It also contains an example for the application context.

    Regards,
    Andreas
    Hey Andreas! You know what they say, "great minds think alike", but then they also say "fools seldom differ". Not sure which category I fall in

    I would suggest that my BeanPostProcessor solution is a little more elegant (and safer) than implementing FactoryBeanAware (or ApplicationContextAware) and InitialisingBean simply because if the bean is a prototype you then setThis will be called with a different instance, which is absolutely what you do not want

    I really must blog this...time and all that.
    Colin Yates
    SpringSource - http://www.springsource.com - Spring Training, Consulting, and Support - "From the Source"
    Please read http://www.springframework.org/documentation
    Co-Author of Expert Spring MVC + Web Flow.

  3. #13
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Quote Originally Posted by yatesco
    Hey Andreas! You know what they say, "great minds think alike", but then they also say "fools seldom differ". Not sure which category I fall in
    ...or I

    Quote Originally Posted by yatesco
    I would suggest that my BeanPostProcessor solution is a little more elegant (and safer) than implementing FactoryBeanAware (or ApplicationContextAware) and InitialisingBean simply because if the bean is a prototype you then setThis will be called with a different instance, which is absolutely what you do not want
    I agree. Only wondering, where I suggested implementing FactoryBeanAware? I guess you refer to my explicit usage of ProxyFactoryBean. In that case, yes, for prototypes it would be a problem.


    Quote Originally Posted by yatesco
    I really must blog this...time and all that.
    Yes, that would really be a good topic.

    Regards,
    Andreas

  4. #14
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    Quote Originally Posted by Andreas Senft
    I agree. Only wondering, where I suggested implementing FactoryBeanAware? I guess you refer to my explicit usage of ProxyFactoryBean. In that case, yes, for prototypes it would be a problem.
    I am not sure who referred to it, someone mentioned (I also mentioned this as well) that if your bean implemented FactoryBeanAware/ApplicationContextAware it could then do a
    Code:
    setApplicationContext(ApplicationContext ctx) { this._decoratedThis = ctx.getBean(getBeanName()) }
    etc. but this absolutely ties you down to spring and you need to implement BeanNameAware, ApplicationContextAware and InitialisingBean!
    Colin Yates
    SpringSource - http://www.springsource.com - Spring Training, Consulting, and Support - "From the Source"
    Please read http://www.springframework.org/documentation
    Co-Author of Expert Spring MVC + Web Flow.

Posting Permissions

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