`
小嘴冰凉
  • 浏览: 449814 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

spring 2.x一些东西

阅读更多
<?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:context="http://www.springframework.org/schema/context"  
        xmlns:tx="http://www.springframework.org/schema/tx"  
        xmlns:aop="http://www.springframework.org/schema/aop"  
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd   
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd   
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd   
                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd   
                ">
     <!-- 	<aop:aspectj-autoproxy /> -->
   	<context:property-placeholder location="jdbc.properties"></context:property-placeholder>
	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
		<property name="driverClass" value="${jdbc.driverClassName}"/>
		<property name="jdbcUrl" value="${jdbc.url}"/>
		<property name="user" value="${jdbc.username}"/>
		<property name="password" value="${jdbc.password}"/>
	</bean>
	
	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="mappingResources">
			<list>
				<value>com/sheng/hibernate/Aaddress.hbm.xml</value>
				<value>com/sheng/hibernate/Aperson.hbm.xml</value>
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
				<prop key="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</prop>
				<prop key="hibernate.c3p0.max_size">20</prop>
				<prop key="hibernate.c3p0.min_size">2</prop>
				<prop key="hibernate.c3p0.timeout">2000</prop>
				<prop key="hibernate.c3p0.max_statements">10</prop>
			</props>
		</property>
		<property name="dataSource" ref="dataSource"></property>
	</bean>
	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
	
	<bean id="trasactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
		<property name="transactionManager" ref="transactionManager"></property>
	</bean>
	
	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
		<property name="sessionFactory" ref="sessionFactory"></property>
	</bean>
	<bean id="insert" class="com.sheng.test.bean.Insert">
<!--	<property name="transactionTemplate" ref="trasactionTemplate"></property>   -->
		<property name="hibernateTemplate" ref="hibernateTemplate"></property>
	</bean>
	
<!--	spring 1.x 事务处理
	<bean id="myTransactionProxyBean" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" lazy-init="true">
		<property name="transactionManager" ref="transactionManager"></property>
		<property name="transactionAttributes">
			<props>
				<prop key="insert*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>
	
	<bean id="insertPersonTransaction" parent="myTransactionProxyBean">
		<property name="target" ref="insert"></property>
	</bean>
-->

<!--   spring 1.0 aop
	<bean id="sayHelloBeforeAOP" class="com.sheng.aop.SayHello">
	</bean>
	
	<bean id="sayTarget" class="com.sheng.aop.SayImp">
	</bean>
	<bean id="afterSay" class="com.sheng.aop.AfterAdvice"></bean>
	
	<bean id="say" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="interceptorNames">
			<list>
				<value>sayHelloBeforeAOP</value>
				<value>afterSay</value>
			</list>
		</property>
		
		<property name="proxyInterfaces">
			<list>
				<value>com.sheng.aop.inner.ISay</value>
			</list>
		</property>
		
		<property name="target">
			<ref bean="sayTarget" />
		</property>
	</bean>
	
 -->
 
 <!-- spring 2.x aspect -->
 <bean id="beforAdvice" class="com.sheng.aspect.aop.MethodBeforeAdvice"></bean>
 
 
 <!-- spring 2.x 事务处理 -->
	<aop:config	proxy-target-class="true">
		<aop:advisor advice-ref="testAdvice" pointcut="execution(* com.sheng.test.bean.Insert.insert*()) "/>
		<!-- spring 2.x aop -->
		<aop:aspect ref="beforAdvice">
			<aop:before method="sayHello" pointcut="execution(* com.sheng.test.bean.Insert.insert*())" />
		</aop:aspect>
	</aop:config>
	
	<tx:advice id="testAdvice" transaction-manager="transactionManager">
		<tx:attributes>
			<tx:method name="insert*" propagation="REQUIRED"/>
		</tx:attributes>
	</tx:advice>
</beans>
分享到:
评论

相关推荐

    Spring 3.x企业应用开发实战.pdf

    不错的东西,值得下载。对于想学Spring的人来说。不错

    Spring Security 2.0.x完全中文参考文档

    Spring Security 2.0.x完全中文参考文档 学习Asegi Security 的不可或缺的东西! 完全版文档,绝无仅有!

    spring framework 3.2.2的源码+build.xml

    想研究spring源码的可以好好学习一下,spring的东西真的很不错,组件化设计

    Java架构师之源码分析专题SpringBoot2.x、Spring5、SpringMVC、Mybatis源码分析

    Java架构师之源码分析专题SpringBoot2.x、Spring5、SpringMVC、Mybatis源码分析,源码中我们可以学到很多东西,学习别人高效的代码书写、学习别人对设计模式的熟练使用、学习别人对整个架构的布局等等。目前...

    塔罗科公司.zip

    分公司2.x:弹簧靴2.0.5.释放 弹簧云finchley.sr1;分公司nacos:弹簧云阿里巴巴;Master 分支已经改为从 nacos merge 代码,今后更新的中心也会放在 nacos 分支上。整体架构项目目录结构项目截图后端环境JDK1.8 ...

    分析 Spring 可用的 UML

    主要是为了分析 Spring 的源代码,自己画序列图理思路学习之用,使用 Ration Rose 逆向生成 Spring 3.2.x 系列,内容仅是类和接口,提供这些东西省去大家一些麻烦能直接画图。

    spring security 参考手册中文版

    23.4.2 Spring WebSocket允许的来源 186 23.4.3添加CSRF到Stomp头 186 23.4.4在WebSockets中禁用CSRF 187 23.5使用SockJS 187 23.5.1 SockJS和框架选项 187 23.5.2轻松放松CSRF 188 第五部分授权 190 24.授权体系...

    spring web flow demo

    要了解 Spring Web Flow 是什么东西,最好的办法莫过于查看示例,图 2 展示了一个简化的购物车的流 程。 图 1 购物车示例 图 2 所示流程用 Spring Web Flow 2.0 的配置文件表示如下: 清单 1 用 Spring Web Flow ...

    Spring 2.5.6介绍(九)——spring中没介绍的东西

    NULL 博文链接:https://zpx138332.iteye.com/blog/1018900

    angular-ts-test:以TypeScript方式使用AngularJS 1.x! 通过Decorators和基于类型的DI获得真正的Angular2感觉!

    在花了一些时间试图使我的AngularJS 1.x项目尽可能整洁之后,我决定利用TypeScript语言的出色可读性,并使用Spring(和其他Java框架)开发人员非常熟悉的功能来丰富它:基于类型的依赖注入。 如果您有一些Spring编程...

    Redis-x64-3.2.100.zip

    最近在安装spring cloud,因安装在阿里云上,基于安全防护原则,有些东西必须必须安装本地,东西放上面便于下次使用

    SpringBoot 注册自己的Servlet(三种方式)(源代码)

    springboot内部绑定了嵌入式http servlet容器Jetty,主体框架基于spring,而spring除了Ioc(依赖注入)、Aop(切面)外,其它与http相关的东西都是基于Servlet和Filter的,而Servlet、Filter是servlet容器Jetty按照...

    spring-generator

    spring-generator一个用于生成Spring项目的东西,包含web.xml,根上下文和web上下文,以及Hibernate的基本配置。基本使用在下载压缩包,解压。编辑conf.properties文件,其中groupId, artifactId字段为必填,其余...

    awesome-spring-boot:Spring Boot和闪亮事物的基于代码的实际示例。 :smiling_face_with_heart-eyes:

    很棒的Sprint Boot子 精选的Spring Boot,资源和闪闪发光的东西的精选清单。内容讲解之后,Spring Boot开始工作项目建立描述Gradle将Spring Boot与JDBC集成 Gradle将Spring Boot与JPA集成Gradle将Spring Boot与...

    Spring Boot 构建一个 RESTful Web 服务

    Spring Boot 全面支持开发 RESTful 程序,通过不同的注解来支持前端的请求,除了经常使用的注解外,Spring Boot 还提供了一些组合注解。这些注解可以帮助简化常用的 HTTP 方法的映射,并更好地表达被注解方法的语义...

    iuhyiuhkjh908u0980

    入门级的东西. JBPM文档1、 加入JBPM支持包下载jbpm-starters-kit-3.1.4在项目的classPath中加入jbpm-3.1.4.jar、jbpm-identity-3.1.2.jar、jbpm-webapp-3.1.2.jar,jbpm-3.1.4.jar必须加入,是JBPM的核心包;bpm-...

    java面试大全-黑马

    去掉了EJB 2.x、JSF等无用内容或过时内容,补充了数据结构和算法、大型网站技术架构、设计模式、UML、Spring MVC等内容并对很多知识点进行了深入的剖析,例如hashCode方法的设计、垃圾收集、并发编程、数据库事务等...

    骆昊JAVA面试题全集

    去掉了EJB 2.x、JSF等无用内容或过时内容,补充了数据结构和算法、大型网站技术架构、设计模式、UML、Spring MVC等内容并对很多知识点进行了深入的剖析,例如hashCode方法的设计、垃圾收集、并发编程、数据库事务等...

Global site tag (gtag.js) - Google Analytics