本文来自:fair-jm.iteye.com 转截请注明出处
hibernate用的是4.2.6 spring是4.0.2
这回是XML的配置文件 我丢:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 使用注解的方式 --> <context:component-scan base-package="com.cc.crm" /> <context:annotation-config /> <!--映入src下的jdbc.porpertise 文件 --> <context:property-placeholder location="classpath:jdbc.properties" /> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="myDataSource" /> <!-- 映入映射文件 --> <!-- <property name="mappingLocations"> <list> <value>classpath:com/products/*.hbm.xml</value> </list> </property> --> <property name="packagesToScan"> <list> <value>com.cc.crm.vo</value> </list> </property> <!-- 加入在外面写好的数据库中的注解 --> <property name="hibernateProperties" ref="hibernateProperties" /> </bean> <!-- 配置数据源 --> <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <!-- 数据库中的相关属性 --> <bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="properties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.format_sql">${hibernate.format_sql}</prop> </props> </property> </bean> <!-- 事务配置 --> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 配置事务的传播特性 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="load*" propagation="REQUIRED" /> <tx:method name="get*" propagation="REQUIRED" read-only="true"/> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="add" propagation="REQUIRED" /> <tx:method name="*" read-only="true" /> </tx:attributes> </tx:advice> <!-- 那些类的哪些方法参与事务 --> <aop:config> <aop:pointcut id="allServiceMethod" expression="execution(* com.cc.crm.service.impl.*.*(..))" /> <aop:advisor pointcut-ref="allServiceMethod" advice-ref="txAdvice" /> </aop:config> </beans>
还有一个配置文件:
jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/crm jdbc.username=root jdbc.password= hibernate.dialect=org.hibernate.dialect.MySQLDialect hibernate.hbm2ddl.auto=update hibernate.current_session_context_class=thread hibernate.show_sql=true hibernate.format_sql=true
JDK8用spring3.2.X会爆错 ClassReader的错 是ASM 要么hijack一下进行本地编译 要么换用spring 4.X 后者我试了下直接替换没什么大问题.
相关推荐
该资源中包含SSH框架整合中spring框架所需要的配置文件:applcationContext.xml和log4j.proerties
Strtuts2中web.xml的配置文件,struts2的配置文件,hibenate的配置文件,spring的配置文件
对于刚刚接触ssh这3个框架集成的初学者来说,一定被其中的配置文件搞得一头雾水。作者结合教学过程中经验,用图例讲解。旨在使读者一目了然了解之间调用关系。彻底揭开SSH神秘面纱。
SSH开发所需的包和配置文件,觉得可用,不要用myeclipse自动生成struts、hibernate、spring能力,自己添加,这个文件包括所需的包和web.xml,struts.xml,applicationContext.xml
这是我自己在很多比较成熟的配置文件中提取总结出来的,非常实用和完整的配置文件,自动扫包,做项目时直接复制进去就完全搞定。
--读取properties资源文件配置,如deploy.properties--> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <value>classpath:/deploy.properties <!--...
ssh整合所需的jar包,spring-4.2.4版本,c3p0连接池,mysql数据库,hibernate-5.0.7版本,struts-2.3.24版本, spring-mvc.xml文件,web.xml文件,spring-common.xml文件,Adc.hbm.xml文件
XML文件提供应用程序一个数据交换的格式,DTD正是让XML文件能成为数据交换标准,因为不同的公司只需定义好标准DTD,各公司都能依DTD建立XML文件,并且进行验证,如此就可以轻易的建立标准和交换数据,这样满足了网络共享...
spring 配置方法,xml文件,爱好ssh框架的通知们来把,spring配置事物管理,配置数据源
Spring配置文件中关于事务配置总是由三个组成部分,分别是DataSource、TransactionManager和代理机制这三部分,无论哪种配置方式,一般变化的只是代理机制这部分。 DataSource、TransactionManager这两部分只是会...
sp页面的form表单里面有一个属性值action,当提交jsp页面上的form表单时,系统会根据action的值来找到servlet里面具体的action,(这里的servlet是在web.xml配置文件里面),然后调用action里面的execute()方法,...
配置ssh框架的配置文件,在智能家居这个模块中,可以实现以下功能,通过红外线来控制电器的开关,你可以通过点击事件,来控制照明设备、窗帘、插座等家用电器的开关;家庭安防的功能,所谓的家庭安防,就是实现上面的...
配置SSH的步骤: 1 添加依赖库 2 启用Struts2,在Web.xml中配置它的fitler 3 添加Struts2的配置文件,在其中配置Action与请求路径的对应关系。 4 启用Spring,在web.xml中配置它的Lisener
这里是使用spring配置文件管理hibernate。 先配置mysql数据驱动,打开eclipse database explorer perspective,选择tie数据库中的user表,创建hibernate Reverse Engineering 生成vo,还可以生成dao。 5. 这样...
项目包含62个Java源文件、8个PNG图像文件、2个XML配置文件、2个properties配置文件、2个文本文件、2个Markdown文件、1个Gitignore文件和1个IDEA项目文件,共80个文件。系统利用了spring、hibernate、struts2、jsp和...
有二种方式,常用是第一种,把配置文件都写再applicationContext.xml 步骤如下: 1,新建一个工程Web应用程序QSJ_SSH 2,选中工程QSJ_SSH点击Myeclipse->Add Spring 框架->除了Hibernate2 Libraries 不要选外 其他都...
SSH整个的时候,导入Spring配置文件applicationContext.xml出错,需要导入的俩个jar包
Spring4.0和_Hibernate4.0加上_Struts2.3整合的配置文件
SSH2(Spring + Struts2 + Hibernate)是一个流行的Java Web开发框架...struts.xml:Struts2的配置文件,定义Action和Result等。 Action类:处理用户请求和业务逻辑。 JSP页面:展示用户界面。 业务逻辑层(Spring)
VO --> bean.java及 bean.hbm.xml配置文件 Service --> Service接口定义类 DAO --> DAO接口定义类 DAOImpl --> DAO接口Implements实现类 程序配置 --> web.xml 验证框架--> bean-validation.xml (实体验证)、...