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:
Has someone a hint for me? Is there a better solution to my issue? Have I did something completely wrong?
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
java.lang.IllegalStateException: No thread-bound request: use RequestContextFilter