当前位置:编程学习 > JAVA >>

怎么在循环中使用spring里的bean配置

   while(true){
                             //获得连接
                     System.out.print(0);
                             socket = serverSocket.accept();
                            // System.out.print( socket.getInetAddress()+"'"+socket.getLocalAddress()+"''"+socket.getLocalSocketAddress()+"'");
                            
                             //启动线
                            // thread= new LogicThread(socket);
                             thread.setSocket1(socket);//这是线程,注入了spring  第一次是正确的 到循环第二次就错了。怎么解决,原本是用new的 不过用new的话里面的conservice就不能调用了,
                             
                             Infor=thread.getInfor();
                            
                             System.out.println(1);
                             star=2;
                     
                    }

spring 配置是
<bean id="gprsAction" class="com.tds.action.GprsAction"  scope="prototype"  >
  <property name="conservice" ref="condService"/>
  <property name="thread" ref="LogicThread"/>
  </bean>
  <bean id="LogicThread" class="com.tds.bhh.LogicThread"  scope="prototype" >
 
   <property name="conservice" ref="condService" />
  
  </bean>


--------------------编程问答-------------------- 有莫有高手啊
补充:Java ,  Java EE
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,