Announcement Announcement Module
Collapse
No announcement yet.
Problem to making two instance of bean in applicationcontext Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem to making two instance of bean in applicationcontext

    [quote]hi all,
    i am making a class "HibTrans implements FactoryBean,InitializingBean{ "

    this is the code of my getObject method
    public synchronized Object getObject() throws Exception {
    if (null == proxy) {
    ClassLoader loader = target.getClass().getClassLoader();
    InvocationHandler handler = new HibInvocationHandler(target, sessionFactory);
    proxy = Proxy.newProxyInstance(loader, interfaces, handler);
    }
    return proxy;
    }
    public void setTarget(Object o) {
    target = o;
    }

    when i am making two entry in applicationcontext.xml file it is taking only one and for one entry it is working fine

    what is the problem.

    my applictioncontext.xml file is that.
    when i am making any one entry of the following my application is working fine for two entry it work only for first application part.

    <bean id="hibernateTarget" class="HibernateTrans">
    <property name="proxyInterfaces">
    <value>DataServices</value>
    </property>
    <property name="sessionFactory">
    <ref bean="hibernateSessionFactory"/>
    </property>
    <property name="target">
    <ref bean="dataServiceImpl"/>
    </property>
    </bean>
    <bean id="hibernateDataServiceTarget1" class="HibernateTrans">
    <property name="proxyInterfaces">
    <list>
    <value>DataServices1</value>
    </list>
    </property>
    <property name="sessionFactory">
    <ref bean="hibernateSessionFactory"/>
    </property>
    <property name="target">
    <ref bean="dataServiceImpl1"/>
    </property>
    </bean>

    pls help

    Thanks And Regards
    Ajay Maheshwari[/list]

  • #2
    You haven't described the exact problem. What is it that you're trying to do which doesn't work?

    Also, please try to format XML and code more readably, using spaces.

    Comment

    Working...
    X