Announcement Announcement Module
Collapse
No announcement yet.
InstantiationAwareBeanPostProcessor not notified when bean has no class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • InstantiationAwareBeanPostProcessor not notified when bean has no class

    We are trying a new approach to support scoped beans in Spring 1.2 (as we probably cannot wait for Spring 2.0). We use a InstantiationAwareBeanPostProcessor that looks up beans in a scope derived from its bean name suffix. This works find, except for one case: when the bean is created by another factory bean, thus having no class attibute. By debugging the Spring code, we found that for this case (and only for this case!), notifying the InstantiationAwareBeanPostProcessor is explicitly skipped. Now we wonder why this is so?
    A (weird and cumbersome) workaround is to add a dummy class attribute to beans constructed by factory-bean and factory-method. Luckily, Spring first looks for factory-bean, and regards the class attribute only if there is none. But this workaround is not really an option, since we use Spring for a product that is usually extended by our customers, who will not understand why and when to add a dummy class to their scoped beans.
    I know that there are several solutions to use scoped beans with Spring 1.2, but none of them seemed as elegant as our own , until we ran into the problem described above. Is it likely that the behavior of InstantiationAwareBeanPostProcessor will be changed / fixed, or is the risk too high that this would break exiting implementations that cannot cope with the case that beanClass is null? Could there then be an extended interface, that maybe would also receive the factory bean and method?

    Hoping for an interesting discussion,

    -Frank-

  • #2
    Can you please post the question on the dev mailing list? Thanks.

    Comment

    Working...
    X