• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
肥肥大超
博客园    首页    新随笔    联系   管理    订阅  订阅
2014年1月4日
@Scope("prototype")
摘要: spring 默认scope 是单例模式这样只会创建一个Action对象每次访问都是同一个Action对象,数据不安全struts2 是要求 每次次访问 都对应不同的Action scope="prototype" 可以保证 当有请求的时候 都创建一个Action对象 阅读全文
posted @ 2014-01-04 15:45 sheroHuo 阅读(588) 评论(0) 推荐(0)
Spring中注入Bean的方法
摘要: @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配 阅读全文
posted @ 2014-01-04 15:31 sheroHuo 阅读(329) 评论(0) 推荐(0)
强大的注解
摘要: 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) 阅读全文
posted @ 2014-01-04 11:03 sheroHuo 阅读(250) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3