Results 1 to 3 of 3

Thread: BeanFactoryPostProcessor only active in main thread

  1. #1
    Join Date
    Mar 2008
    Posts
    1

    Default 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. #2

    Default

    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??

  3. #3
    Join Date
    Dec 2009
    Location
    India
    Posts
    108

    Default

    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

Posting Permissions

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