clone()方法复制Spring容器中的bean,比如SessionFactory,那么这个克隆的对象,会受到Spring容器管理吗?求大虾指教!!!比如:
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
StudentService studentService = (StudentService) context.getBean("studentServiceBean");
StudentService newStudentService = null ;try {
newStudentService = studentService.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}Student s = newStudentService.find(1);我通过clone()获得的newStudentService ,它受到Spring容器管理吗?就好比我克隆Spring容器中的SessionFactory,由于SessionFactory的close()是spring执行的,所以我需要了解,是克隆的对象也会受spring容器管理!
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
StudentService studentService = (StudentService) context.getBean("studentServiceBean");
StudentService newStudentService = null ;try {
newStudentService = studentService.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}Student s = newStudentService.find(1);我通过clone()获得的newStudentService ,它受到Spring容器管理吗?就好比我克隆Spring容器中的SessionFactory,由于SessionFactory的close()是spring执行的,所以我需要了解,是克隆的对象也会受spring容器管理!
http://blog.csdn.net/eclipser1987/archive/2010/01/28/5265940.aspx