forked from ph3fvx2sj/LabMS25-12A
Compare commits
9 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
778b02c0ee | 1 month ago |
|
|
983fb0d585 | 1 month ago |
|
|
a38aac283b | 1 month ago |
|
|
32f375828d | 1 month ago |
|
|
34be2fe4ad | 2 months ago |
|
|
3898d4e842 | 2 months ago |
|
|
406af2e3cb | 2 months ago |
|
|
3e51b1887d | 2 months ago |
|
|
d5fd395aa7 | 2 months ago |
@ -0,0 +1,10 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/equipment-SpringProject/com.ssm.di.annotation" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/equipment-SpringProject/src/com.ssm.di" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/equipment-SpringProject/com.ssm.ioc" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/equipment-SpringProject/com.ssm.aop.xml/ entity" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/equipment-SpringProject/com.ssm.aop.xml/ test" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/equipment-SpringProject/com.ssm.aop.xml/aspect" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="commons-logging-1.1.1" level="project" />
|
||||
<orderEntry type="library" name="spring-aop-5.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="spring-aop-5.1.6.RELEASE (2)" level="project" />
|
||||
<orderEntry type="library" name="lib (3)" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="commons-logging-1.1.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/equipment-SpringProject/src/lib/commons-logging-1.1.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment-SpringProject/src/lib/spring-beans-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment-SpringProject/src/lib/spring-context-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment-SpringProject/src/lib/spring-core-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment-SpringProject/src/lib/spring-expression-5.1.6.RELEASE.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
@ -0,0 +1,26 @@
|
||||
<component name="libraryTable">
|
||||
<library name="lib">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/spring-core-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/spring-expression-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/spring-webmvc-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/mybatis-3.5.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/spring-aop-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/spring-context-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/mybatis-spring-2.0.3.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/spring-jdbc-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/spring-web-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/spring-beans-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/commons-pool2-2.7.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/spring-tx-5.1.6.RELEASE.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/commons-dbcp2-2.5.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/commons-fileupload-1.3.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/commons-logging-1.1.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/commons-io-2.5.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/jstl-1.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/equipment/web/WEB-INF/lib/mysql-connector-java-8.0.11.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="lib (2)">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/equipment-SpringProject/src/lib" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/equipment-SpringProject/src/lib" recursive="false" />
|
||||
</library>
|
||||
</component>
|
||||
@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="lib (3)">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/equipment-SpringProject/src/lib" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/equipment-SpringProject/src/lib" recursive="false" />
|
||||
</library>
|
||||
</component>
|
||||
@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="spring-aop-5.1.6.RELEASE">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/equipment-SpringProject/src/lib/spring-aop-5.1.6.RELEASE.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="spring-aop-5.1.6.RELEASE (2)">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/equipment-SpringProject/src/lib/spring-aop-5.1.6.RELEASE.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/LabMS25-12A.iml" filepath="$PROJECT_DIR$/.idea/LabMS25-12A.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/equipment/equipment.iml" filepath="$PROJECT_DIR$/equipment/equipment.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/equipment-MyBatisProject/equipment-MyBatisProject.iml" filepath="$PROJECT_DIR$/equipment-MyBatisProject/equipment-MyBatisProject.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/equipment-SpringMVCProject/equipment-SpringMVCProject.iml" filepath="$PROJECT_DIR$/equipment-SpringMVCProject/equipment-SpringMVCProject.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/equipment-SpringProject/equipment-SpringProject.iml" filepath="$PROJECT_DIR$/equipment-SpringProject/equipment-SpringProject.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,25 @@
|
||||
package com.ssm.aop.xml.test;
|
||||
|
||||
public class Category {
|
||||
private int type;
|
||||
private String name;
|
||||
private String description;
|
||||
private String status;
|
||||
|
||||
public void printMessage() {
|
||||
System.out.println("商品类型:" + type +
|
||||
" 商品名称:" + name +
|
||||
" 商品描述:" + description +
|
||||
" 状态:" + status);
|
||||
}
|
||||
|
||||
// Getter/Setter、构造方法
|
||||
public Category() {}
|
||||
public Category(int type, String name, String description, String status) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.status = status;
|
||||
}
|
||||
// 省略getter/setter
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.ssm.aop.xml.test;
|
||||
|
||||
public class Content {
|
||||
private int type;
|
||||
private String message;
|
||||
private String sender;
|
||||
private String receiver;
|
||||
|
||||
public void printContent() {
|
||||
System.out.println("类型:" + type +
|
||||
" 消息:" + message +
|
||||
" 发送者:" + sender +
|
||||
" 接收者:" + receiver);
|
||||
}
|
||||
|
||||
// Getter/Setter、构造方法
|
||||
public Content() {}
|
||||
public Content(int type, String message, String sender, String receiver) {
|
||||
this.type = type;
|
||||
this.message = message;
|
||||
this.sender = sender;
|
||||
this.receiver = receiver;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ssm.aop.xml.test;
|
||||
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
|
||||
public class Log {
|
||||
// 前置通知:目标方法执行前触发
|
||||
public void beforeLog(JoinPoint joinPoint) {
|
||||
// 获取目标对象和方法名
|
||||
Object target = joinPoint.getTarget();
|
||||
String methodName = joinPoint.getSignature().getName();
|
||||
System.out.println("前置通知:模拟日志的记录...目标类是:" + target +
|
||||
",被切入通知的目标方法为:" + methodName);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.ssm.aop.xml.test;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class TestAnnotation {
|
||||
public static void main(String[] args) {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("com/ssm/aop/xml/test/bean-di-aop.xml");
|
||||
|
||||
// 测试Category
|
||||
Category category = (Category) ac.getBean("category");
|
||||
category.printMessage();
|
||||
|
||||
// 测试Announcement
|
||||
Announcement announcement = (Announcement) ac.getBean("announcement");
|
||||
announcement.printPub();
|
||||
|
||||
// 测试Flower
|
||||
Flower flower = (Flower) ac.getBean("flower");
|
||||
flower.printFlower();
|
||||
|
||||
// 测试Content
|
||||
Content content = (Content) ac.getBean("content");
|
||||
content.printContent();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.ssm.ioc;
|
||||
|
||||
public class Category {
|
||||
|
||||
public void printMessage() {
|
||||
System.out.println("this is Category");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.ssm.ioc;
|
||||
|
||||
public class Order {
|
||||
private String orderId;
|
||||
private String username;
|
||||
private String goodsName;
|
||||
private Integer nums;
|
||||
private String orderDate;
|
||||
|
||||
public Order() {}
|
||||
|
||||
public String getOrderId() { return orderId; }
|
||||
public void setOrderId(String orderId) { this.orderId = orderId; }
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getGoodsName() { return goodsName; }
|
||||
public void setGoodsName(String goodsName) { this.goodsName = goodsName; }
|
||||
public Integer getNums() { return nums; }
|
||||
public void setNums(Integer nums) { this.nums = nums; }
|
||||
public String getOrderDate() { return orderDate; }
|
||||
public void setOrderDate(String orderDate) { this.orderDate = orderDate; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("Order{" +
|
||||
"orderId='" + orderId + '\'' +
|
||||
", username='" + username + '\'' +
|
||||
", goodsName='" + goodsName + '\'' +
|
||||
", nums=" + nums +
|
||||
", orderDate='" + orderDate + '\'' +
|
||||
'}');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.ssm.ioc;
|
||||
|
||||
public class Student {
|
||||
private String stuId;
|
||||
private String stuName;
|
||||
private String major;
|
||||
private String className;
|
||||
private Integer age;
|
||||
|
||||
public Student() {}
|
||||
|
||||
public String getStuId() { return stuId; }
|
||||
public void setStuId(String stuId) { this.stuId = stuId; }
|
||||
public String getStuName() { return stuName; }
|
||||
public void setStuName(String stuName) { this.stuName = stuName; }
|
||||
public String getMajor() { return major; }
|
||||
public void setMajor(String major) { this.major = major; }
|
||||
public String getClassName() { return className; }
|
||||
public void setClassName(String className) { this.className = className; }
|
||||
public Integer getAge() { return age; }
|
||||
public void setAge(Integer age) { this.age = age; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("Student{" +
|
||||
"stuId='" + stuId + '\'' +
|
||||
", stuName='" + stuName + '\'' +
|
||||
", major='" + major + '\'' +
|
||||
", className='" + className + '\'' +
|
||||
", age=" + age +
|
||||
'}');
|
||||
}
|
||||
}
|
||||
@ -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"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- 这个类是真实存在的! -->
|
||||
<bean id="user" class="com.ssm.first.User">
|
||||
<property name="name" value="Hello Spring"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@ -0,0 +1,15 @@
|
||||
package com.ssm.di.annotation;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class TestAnnotation {
|
||||
public static void main(String[] args) {
|
||||
|
||||
// 👉 就用这一行!!!
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("com/ssm/di/annotation/bean-di-annotation.xml");
|
||||
|
||||
Product product = (Product) ac.getBean("product");
|
||||
System.out.println(product);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
<?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">
|
||||
|
||||
<!-- 关键:扫描当前包,识别@Component注解 -->
|
||||
<context:component-scan base-package="com.ssm.di.annotation"/>
|
||||
|
||||
</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.
@ -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"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- 这个类是真实存在的! -->
|
||||
<bean id="user" class="com.ssm.first.User">
|
||||
<property name="name" value="Hello Spring"/>
|
||||
</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.
Loading…
Reference in new issue