spring基于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"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<bean id="arithmeticCalculator" class="com.qst.aop.log.xml.ArithmeticCalculatorimpl"></bean>
 <bean id="loggingAspect" class="com.qst.aop.log.xml.LoggingAspect"></bean>
 	<aop:config>
 	        <aop:pointcut expression="execution(public int com.qst.aop.log.xml.ArithmeticCalculator.*(int, int))"
 					 id="pointcut"/>
 			<aop:aspect ref="loggingAspect">
 			<aop:before method="beforeLog" pointcut-ref="pointcut"/>
 			<aop:after method="afterLog" pointcut-ref="pointcut"/>
 			<aop:after-returning method="afterReturningLog" pointcut-ref="pointcut" returning="result"/>
 			<aop:after-throwing method="afterThrowingLog" pointcut-ref="pointcut" throwing="ex"/>		
 			</aop:aspect>
 				
 	</aop:config>
</beans>

阅读之前结合AOP基于注解的日志通知阅读,切面代码在其截图

https://blog.csdn.net/qq_42183409/article/details/89285217

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring.xmlSpring框架中的配置文件,用于配置和管理应用程序中的各种组件和依赖关系。它是基于XML格式的,并且是Spring框架的核心配置文件之一。 在Spring.xml中,可以定义以下内容: 1. Bean定义:通过定义Bean,可以告诉Spring框架如何创建和管理对象。每个Bean都有一个唯一的ID和一个类的全限定名。可以通过配置构造函数参数、属性注入、依赖关系等来配置Bean。 2. 依赖注入:通过配置依赖注入,可以让Spring框架自动管理对象之间的依赖关系。可以使用构造函数注入、Setter方法注入或字段注入来实现依赖注入。 3. 切面配置:通过配置切面,可以实现面向切面编程(AOP)的功能。可以定义切点、通知和切面,并将它们应用到指定的目标对象上。 4. 属性配置:可以在Spring.xml中配置一些属性,如数据库连接信息、日志级别等。这些属性可以在应用程序中通过Spring框架进行读取和使用。 5. 声明式事务管理:可以通过配置声明式事务管理,来实现对数据库事务的管理。可以指定事务传播行为、隔离级别等属性。 6. 其他配置:还可以在Spring.xml中配置其他一些内容,如国际化资源、拦截器、视图解析器等。 总的来说,Spring.xml配置文件是一个非常重要的文件,用于定义和配置应用程序中的各种组件和功能。通过合理配置Spring.xml,可以实现对应用程序的灵活管理和扩展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值