Announcement Announcement Module
Collapse
No announcement yet.
Adding beans dinamically into the application context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Can you post the complete stacktrace?

    Comment


    • #3
      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"?

      Comment

      Working...
      X