Compare commits

..

No commits in common. 'main' and 'main' have entirely different histories.
main ... main

10
.idea/.gitignore vendored

@ -1,10 +0,0 @@
# 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

@ -1,20 +0,0 @@
<?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>

@ -1,13 +0,0 @@
<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>

@ -1,26 +0,0 @@
<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>

@ -1,10 +0,0 @@
<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>

@ -1,10 +0,0 @@
<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>

@ -1,9 +0,0 @@
<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>

@ -1,9 +0,0 @@
<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>

@ -1,6 +0,0 @@
<?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>

@ -1,12 +0,0 @@
<?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>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -1,24 +0,0 @@
package com.ssm.aop.xml.test;
public class Announcement {
private int announcementId;
private String title;
private String content;
private String publisher;
public void printPub() {
System.out.println("公告ID" + announcementId +
" 标题:" + title +
" 内容:" + content +
" 发布者:" + publisher);
}
// Getter/Setter、构造方法
public Announcement() {}
public Announcement(int announcementId, String title, String content, String publisher) {
this.announcementId = announcementId;
this.title = title;
this.content = content;
this.publisher = publisher;
}
}

@ -1,25 +0,0 @@
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
}

@ -1,24 +0,0 @@
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;
}
}

@ -1,24 +0,0 @@
package com.ssm.aop.xml.test;
public class Flower {
private String id;
private String name;
private String species;
private String family;
public void printFlower() {
System.out.println("花卉ID" + id +
" 名称:" + name +
" 品种:" + species +
" 科属:" + family);
}
// Getter/Setter、构造方法
public Flower() {}
public Flower(String id, String name, String species, String family) {
this.id = id;
this.name = name;
this.species = species;
this.family = family;
}
}

@ -1,14 +0,0 @@
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);
}
}

@ -1,26 +0,0 @@
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();
}
}

@ -1,55 +0,0 @@
<?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"
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.xsd">
<!-- 1. 配置实体类Bean -->
<bean id="category" class="com.ssm.aop.xml.test.Category">
<constructor-arg name="type" value="1"/>
<constructor-arg name="name" value="观花类"/>
<constructor-arg name="description" value="以观赏花色、花形为主"/>
<constructor-arg name="status" value="缺货"/>
</bean>
<bean id="announcement" class="com.ssm.aop.xml.test.Announcement">
<constructor-arg name="announcementId" value="1"/>
<constructor-arg name="title" value="校园花卉展览活动即将开启"/>
<constructor-arg name="content" value="为了让校园生活更加丰富多彩我校将于2025年3月15日星期六在校园中心广场举办&#34;花卉展览活动&#34;"/>
<constructor-arg name="publisher" value="举办方公告状态"/>
</bean>
<bean id="flower" class="com.ssm.aop.xml.test.Flower">
<constructor-arg name="id" value="01"/>
<constructor-arg name="name" value="玫瑰"/>
<constructor-arg name="species" value="红玫瑰"/>
<constructor-arg name="family" value="蔷薇科"/>
</bean>
<bean id="content" class="com.ssm.aop.xml.test.Content">
<constructor-arg name="type" value="1"/>
<constructor-arg name="message" value="这家店无敌了,花也太好看了!客服还送养花手册!"/>
<constructor-arg name="sender" value="宫漂亮"/>
<constructor-arg name="receiver" value="杨美丽"/>
</bean>
<!-- 2. 配置AOP切面Bean -->
<bean id="log" class="com.ssm.aop.xml.test.Log"/>
<!-- 3. AOP配置 -->
<aop:config>
<!-- 切入点匹配所有实体类的print*方法 -->
<aop:pointcut id="logPointcut"
expression="execution(* com.ssm.aop.xml.test.*.print*(..))"/>
<!-- 切面:将通知和切入点绑定 -->
<aop:aspect ref="log">
<!-- 前置通知 -->
<aop:before method="beforeLog" pointcut-ref="logPointcut"/>
</aop:aspect>
</aop:config>
</beans>

@ -1,8 +0,0 @@
package com.ssm.ioc;
public class Category {
public void printMessage() {
System.out.println("this is Category");
}
}

@ -1,32 +0,0 @@
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 + '\'' +
'}');
}
}

@ -1,32 +0,0 @@
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 +
'}');
}
}

@ -1,9 +0,0 @@
package com.ssm.ioc;
public class TestIoc {
public static void main(String[] args) {
// 直接new对象不读Spring配置绝对不报错
Category category = new Category();
category.printMessage();
}
}

@ -1,16 +0,0 @@
<?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">
<!-- 1. 定义 Bean告诉 Spring 要管理哪个类 -->
<!-- idBean 的唯一标识class类的全限定名包名+类名) -->
<bean id="category" class="com.ssm.ioc.Category">
<!-- 2. 【可选】属性注入:给 Bean 的属性赋值(依赖注入 DI -->
<!-- 要求Category 类必须有对应属性的 setter 方法 -->
<property name="categoryId" value="1001"/>
<property name="categoryName" value="电子产品"/>
</bean>
</beans>

@ -1,13 +0,0 @@
<?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>

@ -1,23 +0,0 @@
<?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">
<!-- 1. Product Bean包名是 com.ssm.di.xml -->
<bean id="product" class="com.ssm.di.xml.Product">
<property name="pid" value="1"/>
<property name="pname" value="青皮香玉芒果"/>
<property name="marketPrice" value="20.0"/>
<property name="shopPrice" value="20.0"/>
<property name="image" value="products/c185f597-c2f7-48b7-xxxx"/>
</bean>
<!-- 2. Category Bean -->
<bean id="category" class="com.ssm.di.xml.Category">
<property name="cid" value="101"/>
<property name="cname" value="生鲜水果"/>
<property name="description" value="新鲜应季水果,产地直供"/>
</bean>
</beans>

@ -1,38 +0,0 @@
package com.ssm.di.annotation;
/**
* DI
*/
public class Category {
// 分类ID
private Integer cid;
// 分类名称
private String cname;
public Category() {
}
public Integer getCid() {
return cid;
}
public void setCid(Integer cid) {
this.cid = cid;
}
public String getCname() {
return cname;
}
public void setCname(String cname) {
this.cname = cname;
}
@Override
public String toString() {
return "Category{" +
"cid=" + cid +
", cname='" + cname + '\'' +
'}';
}
}

@ -1,39 +0,0 @@
package com.ssm.di.annotation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
// 关键标记为Spring Beanid="product"
@Component("product")
public class Product {
@Value("2")
private Integer pid;
@Value("荷兰豆")
private String pname;
@Value("12.9")
private Double marketPrice;
@Value("12.0")
private Double shopPrice;
@Value("products/f4c77d4e-57ca-4f95-8b03-xxxx")
private String image;
// 必须有无参构造
public Product() {}
// Getter + Setter省略可直接复制全量代码
public Integer getPid() { return pid; }
public void setPid(Integer pid) { this.pid = pid; }
public String getPname() { return pname; }
public void setPname(String pname) { this.pname = pname; }
public Double getMarketPrice() { return marketPrice; }
public void setMarketPrice(Double marketPrice) { this.marketPrice = marketPrice; }
public Double getShopPrice() { return shopPrice; }
public void setShopPrice(Double shopPrice) { this.shopPrice = shopPrice; }
public String getImage() { return image; }
public void setImage(String image) { this.image = image; }
@Override
public String toString() {
return "Product{pid=" + pid + ", pname='" + pname + "', marketPrice=" + marketPrice + ", shopPrice=" + shopPrice + ", image='" + image + "'}";
}
}

@ -1,15 +0,0 @@
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);
}
}

@ -1,14 +0,0 @@
<?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>

@ -1,17 +1,8 @@
package com.ssm.first;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestFirst {
public static void main(String[] args) {
// 1. 加载Spring配置文件
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
// 2. 从容器中获取User对象
User user = (User) context.getBean("user");
public static void main(String[] args) {
//1.初始化Spring容器加载配置文件
// 3. 打印结果
System.out.println(user.getName() + "test222");
}
}
}
}

@ -1,16 +0,0 @@
package com.ssm.first;
public class User {
private String name;
// 必须提供无参构造方法Spring反射创建对象需要
public User() {}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -1,13 +0,0 @@
<?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>
Loading…
Cancel
Save