摘要:
spring 默认scope 是单例模式这样只会创建一个Action对象每次访问都是同一个Action对象,数据不安全struts2 是要求 每次次访问 都对应不同的Action scope="prototype" 可以保证 当有请求的时候 都创建一个Action对象 阅读全文
摘要:
@Autowired是Spring提供的一种注入Bean的方法。具体的应用是: 1)在Service类中定义的注入属性前加@Autowired。例如:@Autowired private PersonDAO personDAO, 2)必须有个set方法,例如:@Autowired public void setPersonDAO(PersonDAO personDAO) { System.out.println("********** @Autowired注入Bean *************"); this.personDAO = personDAO; }Spring配 阅读全文
摘要:
1、struts2 spring hibernate几个重要的注解annotation(1)表示将action交给Spring管理@Component == @Component("testAction") @Component@Scope("prototype")2、数据库中的常用注解:(1),@entity(name="tablename") 类注解@entity 默认的entityname就是类名 告诉hibernate 我这个类需要和数据库对应 对应的数据库表名为tablename(2),@Id 属性注解指明该属性是主键(3) 阅读全文