You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.0 KiB

<?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
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
https://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd">
<!-- 开启注解扫描 -->
<context:component-scan base-package="com.ssm.aop"/>
<!-- 开启AOP自动代理 -->
<aop:aspectj-autoproxy/>
<!-- 注册Bean -->
<bean id="cls" class="com.ssm.aop.ClassEntity">
<property name="classId" value="1"/>
<property name="className" value="软件工程"/>
<property name="studentCount" value="20"/>
</bean>
<bean id="exam" class="com.ssm.aop.Exam">
<property name="eid" value="1"/>
<property name="ename" value="期末考试"/>
<property name="time" value="2026-06-30"/>
</bean>
<bean id="course" class="com.ssm.aop.Course">
<property name="courseId" value="1"/>
<property name="courseName" value="软件工程"/>
<property name="courseCredit" value="2"/>
</bean>
<bean id="score" class="com.ssm.aop.Score">
<property name="scoreId" value="001"/>
<property name="studentId" value="2025001"/>
<property name="score" value="95.5"/>
</bean>
<bean id="log" class="com.ssm.aop.Log"/>
<!-- AOP配置 -->
<aop:config>
<aop:aspect ref="log">
<aop:before method="before"
pointcut="execution(* com.ssm.aop..printInfo(..))"/>
</aop:aspect>
</aop:config>
</beans>