Announcement Announcement Module
No announcement yet.
Changing the value of "ref local" dynamically on r Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing the value of "ref local" dynamically on r

    Hi all,

    I need to be able to change the value on run time as this example:

    <bean id="MySessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
    <property name="dataSource"><ref local="DataSource01"/></property>

    I would like to change the "ref local" value from "Datasource01" into "DataSource02".

    where DataSource01 is
    <bean id="DataSource01" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName"><value>oracle.jdbc.driver.O racleDriver</value></property>
    <property name="url"><value>...</value></property>
    <property name="username"> <value>...</value></property>
    <property name="password"><value>...</value></property>

    and I have similar entries with name DataSource02 which point to different Oracle's URL.

    Any suggestion/pointers/samples are much appreciated, thanks a lot in advanced.


  • #2
    When I last asked about a similar concern I was directed to look into the
    HotSwappableTargetSource. I wanted to be able to swap beans that dealt with different databases, db2 or oracle, at run time, and no access to prop files and the property replacement stuff.