Announcement Announcement Module
Collapse
No announcement yet.
Loading different set of beans based on value of a system property Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Loading different set of beans based on value of a system property

    Hi,

    I have 2 sets of beans. I want to load one of these sets based on a system property through spring context file.

    Can I do this using spring?

    Example: if the system property repositoryLoad = true

    i want to load
    <bean id="mapppingLoader" class="RepositoryMappingDefinitionLoader"></bean>
    <bean id="routingScriptLoader" class="RepositoryScriptDefinitionLoader"></bean>

    or else

    <bean id="mapppingLoader" class="CacheMappingDefinitionLoader"></bean>
    <bean id="routingScriptLoader" class="CacheMappingDefinitionLoader"></bean>

  • #2
    I suggest you read the reference guide, what you want can be achieved using profiles...

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      I suggest you read the reference guide, what you want can be achieved using profiles...
      Thanks Marten...

      But I am using Spring 3.0.5 not 3.1.

      Comment


      • #4
        Then it might be worth an upgrade (should be a drop-in replacement).

        Else create a factorBean for each bean which returns a different instance based on the property.

        Comment


        • #5
          Thanks Marten for the reply..

          I think I wont be able to go with upgradation. I will do with factoryBean.

          Comment

          Working...
          X