Announcement Announcement Module
No announcement yet.
ApplicationContextAwareProcessor usage Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ApplicationContextAwareProcessor usage

    Hi all,

    I am looking for the usage of the ApplicationContextAwareProcessor.

    Problem description:

    I have one container that embeds a dynamic number of classes.
    To get the dynamic number of classes into the container, I used the beanFactory.getBeansOfType (...) and register them in the container using a setter.

    So far so good except for the fact that the container has an initialization in which it receives data that needs to be passed on to the objects in the container.
    At the moment of initialization, the classes are not yet initialized and hence they do not receive the proper initialization.

    What I would like to do is this:
    - instantiate container
    ** intervene -> PostProcessor?
    - retrieve classes from context and assign them to the container
    - initialize container (and pass the data it receives on to its classes)

    I tried to use a BeanPostProcessor to directly after instantiation of the container get the classes and assign them. However to use the getBeansOfType... I need to have access to the context which is not accesible in the Processor... I thought I could use the ApplicationContextAwareProcessor for this, but the framework tries to instantiate the Processor via the default (no argument) constructor... I have no clue how to get to the context.

    Did anyone encounter a similar situation? Can I use an ApplicationContextAwareProcessor for this? Are there more elegant solutions?