Announcement Announcement Module
Collapse
No announcement yet.
BeanFactoryPostProcessor only active in main thread Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BeanFactoryPostProcessor only active in main thread

    Hello,

    i have a divided beandefinition file. A main file and an optional component file, which contains optional beandefinitions. But one of this optional beans should be injected in one bean of the main file, when it is also added to the context.
    My solution was to register a BeanFactoryPostProcessor in the optional beandefinitionfile, which modifies the beandefinition at runtime. This seems to work properly so far, but only in the main thread at application server start. When there is a request by the client the BeanFactoryPostProcessor is not activated and the injection does not happen.

    I use a WebApplicationContext and spring version 2.0.

    I gave a try to set the scope of the BeanFactoryPostProcessor to session, but that leads to this exception:

    Code:
    2008-03-18 12:24:22,911 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'de.cenit.eworks.businessservices.spring.BeanFactoryReportPostProcessor': Scope 'session' is not active; nested exception is java.lang.IllegalStateException: No thread-bound request: use RequestContextFilter
    Caused by: 
    java.lang.IllegalStateException: No thread-bound request: use RequestContextFilter
    Has someone a hint for me? Is there a better solution to my issue? Have I did something completely wrong?

    Thanks!

  • #2
    HI,
    I'm in the same kind of situation where i want to inject beans based on the request parameters. How did u achieve this??

    Comment


    • #3
      Strangely but surely both of you haven't seen controllers. These component instances mapped to different URLs do different kind of things not limited to what you want to do but much beyond that. Refer here or for Spring 2.0 here

      Comment

      Working...
      X