码迷,mamicode.com
首页 > 其他好文 > 详细

记载配置信息

时间:2015-12-30 13:50:30      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:切入通知

<?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:p="http://www.springframework.org/schema/p" xmlns:mvc="http://www.springframework.org/schema/mvc"
	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-3.0.xsd
	  http://www.springframework.org/schema/context
	  http://www.springframework.org/schema/context/spring-context-3.0.xsd
	  http://www.springframework.org/schema/mvc
	  http://www.springframework.org/schema/mvc/spring-mvc-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">

	<!-- hibernate的sessionFactory  由spring管理 -->
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="configLocation" value="classpath:hibernate.cfg.xml">
		</property>
	</bean>
	<!-- sessionfactory交给 spring事务管理器管理 -->
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
	<!-- 数据处理DAO类 sessionfactory工厂类 -->
	<bean id="commondao" class="com.yjm.dao.CommonDAO" scope="singleton">
		<property name="sessionFactory" ref="sessionFactory"></property>
	</bean>

	<!-- 逻辑处理service类 Food-->
	<bean id="foodservice" class="com.yjm.service.FoodService">
		<property name="commonDAO" ref="commondao"></property>
	</bean>
	<!-- 逻辑处理service类 User-->
	<bean id="userservice" class="com.yjm.service.UserService">
		<property name="commonDAO" ref="commondao"></property>
	</bean>

	<bean id="aspectbean" class="com.yjm.aspectbean.AspectBean"></bean>
	<bean id="ta1" class="com.yjm.aspectbean.TestA1"></bean>
	<bean id="testaspect1" class="com.yjm.aspect.TestAspect"></bean>
	<bean id="testaspect" class="com.yjm.aspect.TestAspectImp"></bean>

	<bean id="t1" class="com.yjm.aspectbean1.Test1"></bean>
	<aop:config proxy-target-class="false">

		<aop:aspect ref="testaspect">
			<aop:pointcut id="poicut"
				expression="execution(* com.yjm.aspectbean.*.*(..))" />

			<aop:before method="test1" pointcut-ref="poicut" />
			<aop:after-returning method="test2" pointcut-ref="poicut" />
			<aop:after method="test3" pointcut-ref="poicut" />
			<aop:after-throwing method="test4" pointcut-ref="poicut" />
		</aop:aspect>
		
		
		<aop:aspect ref="testaspect1">
			<aop:pointcut id="poicut1"
				expression="execution(* com.yjm.aspectbean1.*.*(..))" />

			<aop:before method="ect1" pointcut-ref="poicut1" />
			<aop:after-returning method="ect2" pointcut-ref="poicut1" />
			<aop:after method="ect3" pointcut-ref="poicut1" />
			<aop:after-throwing method="ect4" pointcut-ref="poicut1" />
		</aop:aspect>
	</aop:config>
	<bean id="test22" class="com.yjm.aspectbean2.Test2"></bean>
	
	
	<aop:config>
		<aop:aspect ref="testaspect1">
			<aop:pointcut expression="execution(* com.yjm.aspectbean2.*.*(..))"
				id="p1" />
			<aop:before method="ect1" pointcut-ref="p1" />
			<aop:after-returning method="ect2" pointcut-ref="p1" />
		</aop:aspect>
	</aop:config>

</beans>


记载配置信息

标签:切入通知

原文地址:http://yjm199.blog.51cto.com/4408395/1729899

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!