Spring AOP配置

本文介绍了解决Hibernate中asm.jar包与Spring中的asm2.3.3.jar包冲突的方法,通过在MyEclipse中移除特定版本的jar包来确保Hibernate能够正常初始化。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

注意在配置中可能遇到 hibernate中的asm.jar包 与spring中的asm2.3.3.jar包冲突导致hibernate中是不能初始化
  可以通过MyEclipse 中window-->Preference-->spring-->2.5-->移除asm2.3.3.jar包
 
<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

	<bean id="dao" class="cn.veryedu.dao.impl.AccountsTabDAOImpl">
	</bean>
	
	<bean id="service" class="cn.veryedu.service.impl.AccountsTabServiceImpl">
		<property name="dao">	
			<bean parent="ProDao">
				<property name="targetName">
					<value>dao</value>
				</property>
			</bean>
		</property>
		<property name="manager">
			<ref local="manager"/>
		</property>
	</bean>
	
	<!-- 
	<bean id="proxyService" class="cn.veryedu.service.impl.ProxyService">
		<property name="service">	
			<ref local="service"/>
		</property>
		<property name="manager">
			<ref local="manager"/>
		</property>
	</bean>	
	 -->
	 
	<bean id="action" class="cn.veryedu.action.AccountAction" abstract="true">
		<property name="service">
			<bean parent="transactionService">
				<property name="targetName">
					<value>service</value>
				</property>
			</bean>
		</property>
	</bean>
	
	<bean id="manager" class="cn.veryedu.transaction.TransactionManager">
	</bean>
	
	<bean name="/queryAccount" parent="action"></bean>
	<bean name="/modifyAccount" parent="action"></bean>

	<bean id="serviceBeforeAdvice" 
		class="cn.veryedu.advice.ServiceMethodAdvice">
	</bean>

	<bean id="serviceAfterAdvice" 
		class="cn.veryedu.advice.ServerAfterAdvice">
	</bean>

	<bean id="transactionAdvice" 
		class="cn.veryedu.advice.TransactionAdvice">
		<property name="manager">
			<ref local="manager"/>
		</property>
	</bean>

	<bean id="transactionService" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="targetName">
			<value>service</value>
		</property>
		<property name="interceptorNames">
			<list>
				
				<value>serviceBeforeAdvice</value>
				 
				<value>serviceAfterAdvice</value>
				  
				 <value>transactionAdvice</value>
			</list>
		</property>
	</bean>
	<bean id="ProDao" class="org.springframework.aop.framework.ProxyFactoryBean">
		<property name="targetName">
			<value>dao</value>
		</property>
		<property name="interceptorNames">
			<list>
				
				<value>serviceBeforeAdvice</value>
				 
				<value>serviceAfterAdvice</value>
				 
			</list>
		</property>
	</bean>
	
	
</beans>

1, contextLoaderPlngIn-->创建Spring容器环境-->根据contextConfigLocation的值
-->读取Spring的配置创建applicationContext对象-->2, 将applicationContext放入
servletContext对应的Aplication级会话中


delegatingRequestProcessor获得aplicationContext对象 application级会话中重写
processCreateAction获得Spring配置的Action对象

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值