1. 程式人生 > >三大框架(ssh)整合之配置檔案

三大框架(ssh)整合之配置檔案

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
  4.     xmlns:tx="http://www.springframework.org/schema/tx" xmlns:tool="http://www.springframework.org/schema/tool"
  5.     xmlns:context="http://www.springframework.org/schema/context"
  6.     xsi:schemaLocation="
  7.         http://www.springframework.org/schema/beans 
  8.         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
  9.         http://www.springframework.org/schema/tool 
  10.         http://www.springframework.org/schema/tool/spring-tool-3.2.xsd
  11.         http://www.springframework.org/schema/tx 
  12.         http://www.springframework.org/schema/tx/spring-tx.xsd
  13.         http://www.springframework.org/schema/aop
  14.         http://www.springframework.org/schema/aop/spring-aop.xsd
  15.         http://www.springframework.org/schema/context 
  16.         http://www.springframework.org/schema/context/spring-context.xsd
  17. ">
  18. <!--開啟spring註解開發-->
  19. <context:component-scan base-package="com.wuhan.bos"/>
  20. <!--載入jdbc配置檔案-->
  21. <context:property-placeholder location="classpath:jdbc.properties"/>
  22. <!--開啟事務註解-->
  23. <tx:annotation-driven transaction-manager="txManager"/>
  24. <bean id="txManager"
  25. class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  26. <property name="sessionFactory" ref="sessionFactory"/>
  27. </bean>
  28. <!--工廠bean (已經整合了hibernate)-->
  29. <bean id="sessionFactory"
  30. class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  31. <property name="dataSource" ref="dataSource"/>
  32. <property name="hibernateProperties">
  33. <props>
  34. <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
  35. <prop key="hibernate.show_sql">true</prop>
  36. <prop key="hibernate.format_sql">false</prop>
  37. </props>
  38. </property>
  39. <!--配置hibernate對映-->
  40. <property name="mappingDirectoryLocations">
  41. <list>
  42. <value>classpath:com/wuhan/bos/domain</value>
  43. </list>
  44. </property>
  45. </bean>
  46. <!-- c3p0資料來源 dataSource -->
  47. <bean id="dataSource"class="com.mchange.v2.c3p0.ComboPooledDataSource">
  48. <property name="driverClass" value="${driverClass}"></property>
  49. <property name="jdbcUrl" value="${jdbcUrl}"></property>
  50. <property name="user" value="${user}"></property>
  51. <property name="password" value="${password}"></property>
  52. </bean>
  53. <!--遠端呼叫服務-->
  54. <bean id="customerService"
  55. class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
  56. <property name="serviceInterface" value="cn.itcast.crm.service.CustomerService"/>
  57. <property name="serviceUrl" value="http://localhost:8080/crm/remoting/customer"></property>
  58. </bean>
  59. </beans>
四.hibernate的配置檔案(已經整合到了Spring的配置檔案中了,也可單獨配置hibernate-cfg.xml檔案,然後配置到sessionFactory中)

相關推薦

三大框架(ssh)整合配置檔案

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-

SSH整合配置檔案

來自:http://www.cnblogs.com/luoyun/archive/2013/01/03/2843322.html 為web應用提供Struts2支援 1.編輯web應用的web.xml配置檔案,配置Struts2的核心Filter來攔截使用者請求。

最新的三大框架整合配置檔案詳解

一:spring.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://

[ssh] spring-springmvc-hibernate整合配置檔案

1.web.xml檔案: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:

SSH框架整合的MAVEN專案配置檔案整合

在最近的SSH框架知識回顧之後,整合了一些所需的配置檔案,並將配置檔案中的配置項記錄下來,避免在以後的開發中進行重複性編碼 首先是web專案的核心配置檔案 web.xml <?xml version="1.0" encoding="UTF-8"?&

三大框架ssh)學習——配置檔案詳解(一)

配置檔案詳解 指定web應用預設字符集 <constant name="struts.i18n.encoding" value="gbk" /> 此配置相當於: request.setCharacterEncoding(“gbk”); r

三大框架ssh)學習——配置檔案詳解(二)

多配置檔案實現 專案經常需要多人協作開發,但是如果大家都是用同一個struts.xml檔案,會互相影響不利於開發的正常開展。這樣,我們可以通過<include>元素指定多個配置檔案。 可以在src下面建立多個struts配置檔案。然後再struts.xml中分別引入: str

整合ssm框架配置檔案

ssm整合 一.applicationContext.xml     1.配置資料來源      <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSou

Hibernate hbm 外來鍵關聯——SSH (Spring+Struts+Hibernate)框架搭建配置檔案序列六

      hibernate管理資料庫後,bbm.xml的關聯配置很重要,<many-to-one> 與<one-to-many>一定要配置正確             繼

SSH三大框架整合

ide exceptio 什麽 知識點 iso 明顯 api 解壓 open SSH三個框架的知識點(http://www.cnblogs.com/tuhooo/p/6491906.html) 一、Hibernate框架 1. Hibernate的核心配置文件 1.

07-spring三大框架整合

support 以及 RR 事務管理器 ati body png 方法 nat 1 三大框架整合理論 2 導包(42個) 1 hibernate 1 hibernate/lib/required 2 hibernate/lib/jpa | java pers

SSH三大框架整合(例項)

搭建專案: 搭建一個實際的專案,為了避免影響到你之前已經搭建過的專案,可以先新建一個工作空間,指定一個新的空間來做這一次的專案,不會和其他的專案衝突,尤其是在編碼這一部分。 指定新工作空間的目錄: 一個新的空間: 新建一個專案: 點選next: 點選next:

初學ssm框架整合配置檔案

天才第一步,引入依賴庫。 首先想到web.xml的配置不能少 <!-- 上下文的位置 --> <context-param> <param-name>contextConfigLocation</param-name>

SSH三大框架搭建整合struts2+spring+hibernate

SSH框架整合理論: 在SSH框架的JAVAweb專案的開發過程中,WEB層通常使用的是Struts2+jsp,service層使用的是javaBean,DAO層使用的是hibernate,而spring的使用覆蓋三層。 使用了spring框架之後,我們可以把物件交給spring

使用ssh三大框架整合出現的異常

1. org.hibernate.PropertyNotFoundException: Could not locate getter method for property [cn.itcast.domain.Customer#custId] (adsbygoogle = win

SSH三大框架整合的個人理解

SSH框架在我的眼裡就是一種對MVC模式的一種直觀的體現模式先說說我個人對SSH框架的各個看法與見解1,Struts2框架(view層)這個框架包含了三個要注意的點(除了導包要匯入的準確,刪掉與Hibernate中重複的包以外),下面三個地方的配置,非常關鍵,第一個是在web

擴充套件:SpringBoot+MyBatis框架+mysql資料庫的整合配置檔案版)

開發環境:開發工具:Intellij IDEA 2017.2.3JDK : 1.8.0_144spring boot 版本 : 1.5.10.RELEASEmaven : 3.2.3SpringBoot整合MyBatis加入基礎依賴:mybatis:<dependenc

SSH三大框架整合+利用Ajax實現無重新整理分頁

以下是我利用Struts2.3.24、Spring4.0、Hibernate4.2 結合Mysql資料庫進行的ssh整合,實現分頁需要json.js 首先ssh的整合需要匯入所有的jar包 在web.xml <?xml version="1.0" e

Nginx入門筆記————配置檔案結構

Nginx入門筆記之————配置檔案結構   ... #全域性塊 events { #events塊 ... } http #http塊 { ... #http全域性塊 server #

Struts2的入門配置檔案和傳值問題

struts-base.xml檔案詳解這是struts2的基礎配置檔案必須的 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD