myeclipse中ssh框架整合操作
来源:互联网 发布:上海同济大学网络教育 编辑:程序博客网 时间:2024/06/04 18:19
右键项目选择myeclipse然后add spring的jar包
1.先导入 Sping aop\core\p....core\p.....jdbc
2.导入Struts core\spring
3.导入Hibernate (3个都导入annontations\core\advanced)
其中第2步选spring配置文件
其中第3步选existing(已有的)配置文件选择spring
4.在web.xml文件中进行配置
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
5.在生成的applicationContext.xml文件当中修改一些配置文件:
前面的配置文件加上这三行:
还有下面这两个识别注解和扫描包的标签
<!-- 这个语句的作用是向spring容器注入为了能让系统识别相应的注解
如 @Resource、@Required、@Autowired、@PersistenceContext等注解
-->
<context:annotation-config></context:annotation-config>
<!-- 配置这句话的作用是扫描包,扫描包上的注解,
其实配置了context:componnent-scan 后就可以将 <context:annotion-config/>这个注解移除了
-->
<context:component-scan base-package="com.ssh"></context:component-scan>
6.在applicationContext.xml文件中注入 HibernateTemplate 这个类,并且在 系统对应的 DAO 层使用@Autowired引用这个 HibernateTemplate这个实体对象
applicationContext.xml文件中的配置
<!-- 注入Hibernate的模版类 -->
<bean id="template" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
//DAO中引入这个template并且使用
阅读全文
0 0
- myeclipse中ssh框架整合操作
- myEclipse中配置ssh框架
- SSH整合中 hibernate整合操作
- 用MyEclipse整合SSH框架-讲给菜鸟同学
- MyEclipse整合SSH模式
- 兔子--Myeclipse中搭建SSH框架
- Myeclipse中怎样搭建SSH框架
- 在myeclipse中搭建SSH框架环境
- ssh框架整合中出现的问题
- MyEclipse搭建ssh框架
- myeclipse 搭建ssh框架
- Myeclipse 创建ssh框架
- Myeclipse搭建ssh框架
- MyEclipse 配置SSH框架
- Myeclipse搭建SSH框架
- myeclipse搭建SSH框架
- SSH框架搭建-Myeclipse
- SSH框架整合笔记
- 植物灯测试PPF实验室
- 分割字符串,两个两个分割
- Phoenix常用命令
- java/php对应的AES/CBC/PKCS5Padding模式 加密解密
- Andrew Ng机器学习笔记ex2 逻辑回归
- myeclipse中ssh框架整合操作
- spring框架bean加载 一
- 实现图的邻接矩阵和邻接表的存储
- linux下进程间通信(1)
- Spring Boot学习(三):开发新一代Spring Java应用
- Elasticsearch 5.x 字段折叠的使用
- KindEditor-编辑器设置图标的显示隐藏
- model.py下的Meta笔记
- mac搭建python环境及tensoflow