parent
babd1b752c
commit
348982c5d5
@ -0,0 +1,18 @@
|
||||
package com.ssm.aop;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("bean-aop-xml.xml");
|
||||
|
||||
com.ssm.aop.Class cls = (com.ssm.aop.Class) ac.getBean("cls");
|
||||
cls.setCid(1);
|
||||
cls.setCname("一班");
|
||||
cls.setNum(50);
|
||||
cls.show();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,13 @@
|
||||
<?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"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
<!--配置扫描注解包-->
|
||||
<context:component-scan base-package="com.ssm.controller"></context:component-scan>
|
||||
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<!--配置了一个前提-->
|
||||
<property name="prefix" value="/WEB-INF/view/"></property>
|
||||
<property name="suffix" value=".jsp"></property>
|
||||
</bean>
|
||||
</beans>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,16 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: Lenovo
|
||||
Date: 2026/4/22
|
||||
Time: 19:15
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>入门程序</title>
|
||||
</head>
|
||||
<body>
|
||||
success!
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,16 @@
|
||||
<%--
|
||||
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>
|
||||
@ -0,0 +1,16 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: DELL
|
||||
Date: 2026/4/23
|
||||
Time: 21:38
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>入门程序</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href="hello">hello world</a >
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,16 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: HP
|
||||
Date: 2026/4/25
|
||||
Time: 10:54
|
||||
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>
|
||||
<a href="testRM/onClass">1.Test RequestMapping可以标识在类的前面</a >
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,13 @@
|
||||
<?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"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
<!--配置扫描注解包-->
|
||||
<context:component-scan base-package="com.ssm.controller"></context:component-scan>
|
||||
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<!--配置了一个前提-->
|
||||
<property name="prefix" value="/WEB-INF/view/"></property>
|
||||
<property name="suffix" value=".jsp"></property>
|
||||
</bean>
|
||||
</beans>
|
||||
@ -0,0 +1,22 @@
|
||||
<?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.Class"/>
|
||||
|
||||
</beans>
|
||||
@ -0,0 +1,34 @@
|
||||
<?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.xsd">
|
||||
|
||||
<bean id="class" class="com.ssm.ioc.Class">
|
||||
<property name="classId" value="1"/>
|
||||
<property name="className" value="计算机科学与技术1班"/>
|
||||
<property name="grade" value="2023级"/>
|
||||
<property name="major" value="计算机科学与技术"/>
|
||||
<property name="teacher" value="张老师"/>
|
||||
<property name="studentCount" value="45"/>
|
||||
<property name="description" value="优秀班集体"/>
|
||||
</bean>
|
||||
<bean id="course" class="com.ssm.ioc.Course">
|
||||
<property name="courseId" value="1"/>
|
||||
<property name="courseName" value="Java程序设计"/>
|
||||
<property name="credit" value="4.0"/>
|
||||
<property name="teacher" value="李老师"/>
|
||||
</bean>
|
||||
<bean id="exam" class="com.ssm.ioc.Exam">
|
||||
<property name="examId" value="1"/>
|
||||
<property name="examName" value="期中"/>
|
||||
<property name="examTime" value="09:00:00"/>
|
||||
<property name="examSubject" value="C语言"/>
|
||||
</bean>
|
||||
<bean id="score" class="com.ssm.ioc.Score">
|
||||
<property name="studentId" value="2023001"/>
|
||||
<property name="courseName" value="Java程序设计"/>
|
||||
<property name="grade" value="90.5"/>
|
||||
<property name="semester" value="2023-2024-1"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue