问题描述
- servlet多线程保存数据安全问题
-
@Service("logfcoopService")
public class LogfcoopServiceImpl implements LogfcoopService
{
private LogfcoopDao logfcoopDao;
@Resource
public void setLogfcoopDao(LogfcoopDao logfcoopDao) {
this.logfcoopDao = logfcoopDao;
}
public void add(MjlogfcoopForm logfcoopForm) {
Mjlogfcoop logfcoop = new Mjlogfcoop();
vo2po.logfcoopVo2Po(logfcoopForm, logfcoop);
logfcoop.setCreate_date(new Date());
System.out.println(logfcoop.getClienType());
logfcoopDao.save(logfcoop);}
}这是spring容器中注入的service
LogfcoopService logfcoopService;@Override
public void init() throws ServletException {
super .init();
ServletContext servletContext = this .getServletContext(); WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext); logfcoopService = (LogfcoopService)ctx.getBean("logfcoopService" ); } 这边是servlet中获取service对象然后多请求过来是执行sava方法是怎么个处理机制或者本身存在安全问题呢,求大神指点!
时间: 2024-10-25 23:23:21