From 98546b1759cf8b43050029f9f71c2da79555e49f Mon Sep 17 00:00:00 2001 From: bingor Date: Mon, 10 Oct 2022 11:55:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9D=A6=E5=85=8B=E5=A4=A7=E6=88=98=EF=BC=88?= =?UTF-8?q?=E4=B8=80=E6=9C=9F=EF=BC=89-=E8=AE=BE=E8=AE=A1=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F-=E5=B7=A5=E5=8E=82=E6=A8=A1=E5=BC=8F-=E7=90=86?= =?UTF-8?q?=E8=A7=A3SpringIOC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/msb/springIOC/Driver.java | 19 +++++++++++++++++ src/main/java/com/msb/springIOC/Main.java | 23 +++++++++++++++++++++ src/main/resources/applicationContext.xml | 7 +++++++ 3 files changed, 49 insertions(+) create mode 100644 src/main/java/com/msb/springIOC/Driver.java create mode 100644 src/main/java/com/msb/springIOC/Main.java create mode 100644 src/main/resources/applicationContext.xml diff --git a/src/main/java/com/msb/springIOC/Driver.java b/src/main/java/com/msb/springIOC/Driver.java new file mode 100644 index 0000000..c7acdeb --- /dev/null +++ b/src/main/java/com/msb/springIOC/Driver.java @@ -0,0 +1,19 @@ +package com.msb.springIOC;/** + * @Author bingor + * @Date 2022/10/10 11:00 + * @Description: com.msb.springAOC + * @Version: 1.0 + */ + +/** + *@ClassName Driver + *@Description TODO + *@Author bingor + *@Date 2022/10/10 11:00 + *@Version 3.0 + */ +public class Driver { + public Driver() { + System.out.println("new Driver"); + } +} diff --git a/src/main/java/com/msb/springIOC/Main.java b/src/main/java/com/msb/springIOC/Main.java new file mode 100644 index 0000000..a5d83df --- /dev/null +++ b/src/main/java/com/msb/springIOC/Main.java @@ -0,0 +1,23 @@ +package com.msb.springIOC;/** + * @Author bingor + * @Date 2022/10/10 11:00 + * @Description: com.msb.springAOC + * @Version: 1.0 + */ + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + *@ClassName Main + *@Description TODO + *@Author bingor + *@Date 2022/10/10 11:00 + *@Version 3.0 + */ +public class Main { + public static void main(String[] args) { + ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); +// Driver driver = (Driver) context.getBean("driver"); + } +} diff --git a/src/main/resources/applicationContext.xml b/src/main/resources/applicationContext.xml new file mode 100644 index 0000000..f94c065 --- /dev/null +++ b/src/main/resources/applicationContext.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file