Results 1 to 3 of 3

Thread: Adding beans dinamically into the application context

  1. #1
    Join Date
    Aug 2004
    Posts
    10

    Default Adding beans dinamically into the application context

    Is it possible to create *new* beans dinamically inside a post processor and add them to the application context?

    I tried to call beanFactory.registerBeanDefinition() inside postProcessAfterInitialization but an error occurs:

    java.util.ConcurrentModificationException
    at java.util.AbstractList$Itr.checkForComodification( AbstractList.java:449)
    at java.util.AbstractList$Itr.next(AbstractList.java: 420)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:419)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:729)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:381)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:255)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:199)

  2. #2
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    Can you post the complete stacktrace?

  3. #3
    Join Date
    Aug 2004
    Posts
    10

    Default

    Ths stack trace is just it. The rest is just from tomcat.

    What I want to do is: when an specific type of bean is found, create dinamically a new bean related to the found one.

    But where is the correct extension point to be used, so I can access the beanFactory when it is no "frozen"?

Posting Permissions

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