BO tier and DAO tier you mentioned are basically designed to be singular instance.It's definitely correct.And yet, they are also designed to be stateless bean.That is to say,they often only own service methods without carrying any data.That means there is no sharing data between multiple threads unless you can guarantee not to access a sharing class which is stateful class in your BO or DAO.Therefore,it's impossible to produce thread-safe issue. However,in case you need to access a sharing class which is stateful class in your BO or DAO,it is proposed to design it to be thread-safe class by adding keyword sychronized or other newly APIs (since JDK 1.5 )to tackle thread-safe issues. Above all, just from my point of view.I hope it's beneficial and favorable to cure your concern.
However,in case you need to access a sharing class which is stateful class in your BO or DAO,it is proposed to design it to be thread-safe class by adding keyword sychronized or other newly APIs (since JDK 1.5 )to tackle thread-safe issues.
Above all, just from my point of view.I hope it's beneficial and favorable to cure your concern.
那你的意思是说,如果是web网站,像上面我说的情况,spring IOC注入的就不能是单例?可是我的案例项目中,并没有这样做啊。所以我才觉得奇怪