董倩 2 weeks ago
parent 1e83b66522
commit ea27605aa5

@ -1,14 +0,0 @@
package com.ssm.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("testRM")
public class TestRequestMappingController {
@RequestMapping("onClass")
public String onClass(){
return "showRequestMapping";
}
}

@ -1,16 +0,0 @@
<%--
Created by IntelliJ IDEA.
User: HP
Date: 2026/4/25
Time: 11:00
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Test RequestMapping!</title>
</head>
<body>
Success!
</body>
</html>

@ -33,6 +33,11 @@
<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"/>

@ -22,4 +22,10 @@ public class Log {
System.out.println("【前置通知】执行时间 " + new Date());
System.out.println("==================================");
}
public void before(JoinPoint joinPoint, Score score) {
System.out.println("==================================");
System.out.println("【前置通知】开始执行的方法 " + joinPoint.getSignature().getName() );
System.out.println("【前置通知】执行时间 " + new Date());
System.out.println("==================================");
}
}

@ -0,0 +1,34 @@
package com.ssm.aop;
public class Score {
private Integer scoreId;
private Integer studentId;
private Double score;
public Score() {}
public Integer getScoreId() { return scoreId; }
public void setScoreId(Integer scoreId) { this.scoreId = scoreId; }
public Integer getStudentId() { return studentId; }
public void setStudentId(Integer studentId) { this.studentId = studentId; }
public Double getScore() { return score; }
public void setScore(Double score) { this.score = score; }
// 重写toString
@Override
public String toString() {
return "Score{" +
"成绩ID=" + scoreId +
", 学生学号=" + studentId +
", 考试分数=" + score +
'}';
}
// printInfo方法
public void printInfo() {
System.out.println("\n===== 成绩信息 =====");
System.out.println("成绩ID" + scoreId);
System.out.println("学生学号:" + studentId);
System.out.println("考试分数:" + score);
}
}

@ -10,6 +10,8 @@ public class Test {
c.printInfo();
Course course = (Course) ac.getBean("course");
course.printInfo();
Score score = (Score) ac.getBean("score");
score.printInfo();

@ -33,9 +33,11 @@
<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"/>

Loading…
Cancel
Save