Announcement Announcement Module
Collapse
No announcement yet.
Overriding Beans using multiple configurations, with defaults Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Overriding Beans using multiple configurations, with defaults

    Hi,

    I have a question about overriding bean names for particular deployments. I have looked in the docs, and searched the mailing lists, but can't find anything relevant, so I hope its not too obvious a question.

    I have a bunch of resources that implement some interface. Lets say they provide stock prices.

    I would like to define a default named configuration, lets say "production", and also let a user specify an override, which will override the particular definition.

    stock-web-service.xml
    <bean id="stock-web-service" class="a.b.c.D">
    ...
    </bean>

    stock-data-provider-a.xml
    <bean id="stock-data-provider-a" class="a.b.a.D">
    ...
    </bean>

    stock-flat-file.xml
    <bean id="stock-flat-file-provider" class="a.b.b.D">
    ...
    </bean>

    I then would like to link these together in a "default" config, something like this:

    production.xml
    <alias name="stock-web-service" name="stock-price-service"/>
    <alias name="something-else" name="stock-issuer-service"/>
    (assume that there are a bunch of other resource aliases here)

    So, when configuring the application, we can say new ClasspathXmlApplicationContext("production.xml").

    However, I would then like a particular user to be able to request a set up, say:
    production + stock-data-provider-a, or
    production + stock-issuer-service-b + stock-data-provider-a

    My question is then how to make the override... Aliases cannot be redefined, and while a classpathxmlapplicationcontext will allow me to override particular beans, it can't (as I understand it) group 'some set' of beans into a defined configuration name.

    Using a SingletonBeanFactoryLocator will allow me to group certain configuration files into a default, but won't let me override single resources.

    If anybody has any ideas, I would much appreciate.

    Thanks!

    James
Working...
X