diff --git "a/\345\220\264\344\275\263\345\256\207/.idea/compiler.xml" "b/\345\220\264\344\275\263\345\256\207/.idea/compiler.xml"
index c8ec76e234f5cfba6b86a90a4c5d302e0dcb4771..cc9f504486ee7a8947dab89e4c753c8b83eb3e73 100644
--- "a/\345\220\264\344\275\263\345\256\207/.idea/compiler.xml"
+++ "b/\345\220\264\344\275\263\345\256\207/.idea/compiler.xml"
@@ -16,10 +16,12 @@
+
+
\ No newline at end of file
diff --git "a/\345\220\264\344\275\263\345\256\207/.idea/encodings.xml" "b/\345\220\264\344\275\263\345\256\207/.idea/encodings.xml"
index a8a0cc2dc7c5def8ed121d4e8719d9508c2472fe..93e51eb0699b826cc5df73fdcfd4e88769670df6 100644
--- "a/\345\220\264\344\275\263\345\256\207/.idea/encodings.xml"
+++ "b/\345\220\264\344\275\263\345\256\207/.idea/encodings.xml"
@@ -21,5 +21,7 @@
+
+
\ No newline at end of file
diff --git "a/\345\220\264\344\275\263\345\256\207/.idea/misc.xml" "b/\345\220\264\344\275\263\345\256\207/.idea/misc.xml"
index 67680333f87f8e6f1d98f691714e4e148d4588e0..496463d1b723bf9873b6a990e967584b713c93f1 100644
--- "a/\345\220\264\344\275\263\345\256\207/.idea/misc.xml"
+++ "b/\345\220\264\344\275\263\345\256\207/.idea/misc.xml"
@@ -13,6 +13,8 @@
+
+
diff --git "a/\345\220\264\344\275\263\345\256\207/.idea/modules.xml" "b/\345\220\264\344\275\263\345\256\207/.idea/modules.xml"
index 23cb86552041552d8c87fdfb7cda6ad9e0198c87..15a27f65babe5735601af0a1327fd07a7c3005c9 100644
--- "a/\345\220\264\344\275\263\345\256\207/.idea/modules.xml"
+++ "b/\345\220\264\344\275\263\345\256\207/.idea/modules.xml"
@@ -2,6 +2,7 @@
+
diff --git "a/\345\220\264\344\275\263\345\256\207/spring04/src/test/java/MyTest.java" "b/\345\220\264\344\275\263\345\256\207/spring04/src/test/java/MyTest.java"
index 5008da15988f5840e547c3f7760a3a5d6a52c3a0..98d431963b67956e39a94cf60a98ab705dd9356c 100644
--- "a/\345\220\264\344\275\263\345\256\207/spring04/src/test/java/MyTest.java"
+++ "b/\345\220\264\344\275\263\345\256\207/spring04/src/test/java/MyTest.java"
@@ -2,45 +2,59 @@ import com.WJY.controller.DeptController;
import com.WJY.pojo.Dept;
import com.WJY.service.DeptService;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = "classpath:bean.xml")
public class MyTest {
+ @Autowired
+ private DeptController dC;
+
@Test
- public void t1(){
- ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
+ public void t01() {
+ dC.queryAllDeptList();
+ }
+
+ @Test
+ public void t1() {
+ ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
DeptController deptController = context.getBean("deptController", DeptController.class);
deptController.queryAllDeptList();
}
@Test
- public void t2(){
+ public void t2() {
ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
DeptController deptController = context.getBean("deptController", DeptController.class);
deptController.queryDeptOne(5);
}
@Test
- public void t3(){
+ public void t3() {
ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
DeptController deptController = context.getBean("deptController", DeptController.class);
- deptController.addDept(new Dept(0,"尚书部"));
+ deptController.addDept(new Dept(0, "尚书部"));
}
@Test
- public void t4(){
+ public void t4() {
ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
DeptController deptController = context.getBean("deptController", DeptController.class);
deptController.deleteDept(8);
}
@Test
- public void t5(){
+ public void t5() {
ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
DeptController deptController = context.getBean("deptController", DeptController.class);
- deptController.updateDeptOne(new Dept(9,"WJY的尚书部"));
+ deptController.updateDeptOne(new Dept(9, "WJY的尚书部"));
}
}
diff --git "a/\345\220\264\344\275\263\345\256\207/spring04/target/classes/bean.xml" "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/bean.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..d86385ce7c8beb9462fa4be102d710c7cf635fdb
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/bean.xml"
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/controller/DeptController.class" "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/controller/DeptController.class"
new file mode 100644
index 0000000000000000000000000000000000000000..5b1621693301c733867635d148b8fa75d46c41c6
Binary files /dev/null and "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/controller/DeptController.class" differ
diff --git "a/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/dao/DeptDao.class" "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/dao/DeptDao.class"
new file mode 100644
index 0000000000000000000000000000000000000000..a2be0affc50c1fdc43d35b793392f3a3a5364e65
Binary files /dev/null and "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/dao/DeptDao.class" differ
diff --git "a/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/pojo/Dept.class" "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/pojo/Dept.class"
new file mode 100644
index 0000000000000000000000000000000000000000..3f6ccc5539450cd8dd90aa3f5e9ca100864aa325
Binary files /dev/null and "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/pojo/Dept.class" differ
diff --git "a/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/service/DeptService.class" "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/service/DeptService.class"
new file mode 100644
index 0000000000000000000000000000000000000000..db8b28c7a95843998ed5c09de918f8b80878d272
Binary files /dev/null and "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/service/DeptService.class" differ
diff --git "a/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/service/DeptServiceImpl.class" "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/service/DeptServiceImpl.class"
new file mode 100644
index 0000000000000000000000000000000000000000..d9b953d8bd7fac53b645f9ca2a1cde2bd117ea9d
Binary files /dev/null and "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/com/WJY/service/DeptServiceImpl.class" differ
diff --git "a/\345\220\264\344\275\263\345\256\207/spring04/target/classes/db.txt" "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/db.txt"
new file mode 100644
index 0000000000000000000000000000000000000000..314ff056fb28d2f1a744bd2beca4bca4e90a5e1d
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/db.txt"
@@ -0,0 +1,11 @@
+create database mx;
+use mx;
+create table dept(
+dept_id int PRIMARY key auto_increment,
+dept_name VARCHAR(20)
+);
+INSERT INTO `mx`.`dept` (`dept_name`) VALUES ('吏部');
+INSERT INTO `mx`.`dept` (`dept_name`) VALUES ('户部');
+INSERT INTO `mx`.`dept` (`dept_name`) VALUES ('刑部');
+INSERT INTO `mx`.`dept` (`dept_name`) VALUES ('尚书部');
+INSERT INTO `mx`.`dept` (`dept_name`) VALUES ('兵部');
\ No newline at end of file
diff --git "a/\345\220\264\344\275\263\345\256\207/spring04/target/classes/jdbc.properties" "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/jdbc.properties"
new file mode 100644
index 0000000000000000000000000000000000000000..f0bb637a2a64eae6b76a8bf717352fef14bcefba
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring04/target/classes/jdbc.properties"
@@ -0,0 +1,4 @@
+jdbc.driver=com.mysql.cj.jdbc.Driver
+jdbc.url=jdbc:mysql://localhost:3306/mx
+jdbc.username=root
+jdbc.password=123456
\ No newline at end of file
diff --git "a/\345\220\264\344\275\263\345\256\207/spring04/target/test-classes/MyTest.class" "b/\345\220\264\344\275\263\345\256\207/spring04/target/test-classes/MyTest.class"
new file mode 100644
index 0000000000000000000000000000000000000000..3153c23c2f254166a68d0b8f030e75b2ac0ea175
Binary files /dev/null and "b/\345\220\264\344\275\263\345\256\207/spring04/target/test-classes/MyTest.class" differ
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/pom.xml" "b/\345\220\264\344\275\263\345\256\207/spring_anno/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..acf22f37a375f412f1bdb308e6670a0edcfdcc2b
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/pom.xml"
@@ -0,0 +1,92 @@
+
+
+ 4.0.0
+
+ org.example
+ spring_anno
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.36
+ compile
+
+
+
+ org.mybatis
+ mybatis
+ 3.5.16
+
+
+
+
+ com.mysql
+ mysql-connector-j
+ 8.3.0
+
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+
+ org.springframework
+ spring-context
+ 5.3.39
+
+
+
+
+ org.springframework
+ spring-jdbc
+ 5.3.39
+
+
+
+
+
+
+ com.alibaba
+ druid
+ 1.1.21
+
+
+
+
+
+ org.mybatis
+ mybatis-spring
+ 2.0.6
+
+
+
+
+ org.springframework
+ spring-test
+ 5.3.39
+
+
+ com.alibaba
+ druid
+ 1.2.8
+ compile
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/config/JdbcConfig.java" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/config/JdbcConfig.java"
new file mode 100644
index 0000000000000000000000000000000000000000..6b5ed5b12f7aa07f8f49b90e3cd6dbdc1552196a
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/config/JdbcConfig.java"
@@ -0,0 +1,34 @@
+package com.WJY.config;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.stereotype.Component;
+
+@Component
+@PropertySource("classpath:jdbc.properties")
+public class JdbcConfig {
+
+ @Value("${jdbc.driver}")
+ private String driver;
+ @Value("${jdbc.url}")
+ private String url;
+ @Value("${jdbc.username}")
+ private String username;
+ @Value("${jdbc.password}")
+ private String password;
+
+ @Bean
+ public DruidDataSource getdruidDataSource() {
+ //创建数据源对象
+ DruidDataSource dataSource = new DruidDataSource();
+ //设置数据源四个主要属性
+ dataSource.setDriverClassName(driver);
+ dataSource.setUrl(url);
+ dataSource.setUsername(username);
+ dataSource.setPassword(password);
+ return dataSource;
+ }
+
+}
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/config/MybatisConfig.java" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/config/MybatisConfig.java"
new file mode 100644
index 0000000000000000000000000000000000000000..7cfcbb5316028c6621d6642694928c64f586e306
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/config/MybatisConfig.java"
@@ -0,0 +1,25 @@
+package com.WJY.config;
+
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ImportResource;
+import org.springframework.stereotype.Component;
+
+import javax.sql.DataSource;
+
+@Component
+@MapperScan("com.WJY.dao")
+
+public class MybatisConfig {
+
+ @Bean
+ public SqlSessionFactoryBean getSqlSessionFactoryBean(DataSource dataSource) {
+ //创建SqlSessionFactoryBean对象
+ SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
+ //将JdbcConfig的配置内容给这个工厂
+ sqlSessionFactoryBean.setDataSource(dataSource);
+ return sqlSessionFactoryBean;
+ }
+
+}
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/config/SpringConfig.java" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/config/SpringConfig.java"
new file mode 100644
index 0000000000000000000000000000000000000000..359535cd02c3f54a4a2fceb5e721df32b6adc386
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/config/SpringConfig.java"
@@ -0,0 +1,16 @@
+package com.WJY.config;
+
+
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+import org.springframework.context.annotation.ImportResource;
+
+
+@Configuration //声明自己是一个配置类,就相当于是bean.xml
+@ComponentScan({"com.WJY.service","com.WJY.controller"}) //注册mvc三层,因为dao层交给Mybatis管理,所以这里不写com.WJY.dao
+@Import({JdbcConfig.class, MybatisConfig.class}) //mybatisConfig和JdbcConfig交给SpringConfig管理,目的是为了建立联系
+@ImportResource("classpath:mybatis-config.xml")
+public class SpringConfig {
+
+}
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/controller/DeptController.java" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/controller/DeptController.java"
new file mode 100644
index 0000000000000000000000000000000000000000..250c5d6d1e344a229ad8438a0fd10e1fc6490608
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/controller/DeptController.java"
@@ -0,0 +1,41 @@
+package com.WJY.controller;
+
+import com.WJY.pojo.Dept;
+import com.WJY.service.DeptService;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+
+import java.util.List;
+
+@Controller
+public class DeptController {
+
+ //controller调service层
+ @Autowired
+ private DeptService deptService;
+
+ public void setDeptService(DeptService deptService) {
+ this.deptService = deptService;
+ }
+
+ public void queryAllDeptList() {
+ System.out.println(deptService.queryAllDept());
+ }
+
+ public void queryDeptOne(@Param("id") int id) {
+ System.out.println(deptService.queryDeptById(id));
+ }
+
+ public void addDept(Dept dept) {
+ System.out.println(deptService.addDept(dept) > 0 ? "新增成功" : "新增失败");
+ }
+
+ public void deleteDept(@Param("id") int id) {
+ System.out.println(deptService.delDeptById(id) > 0 ? "删除成功" : "删除失败");
+ }
+
+ public void updateDeptOne(Dept dept) {
+ System.out.println(deptService.updateDept(dept) > 0 ? "修改成功" : "修改失败");
+ }
+}
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/dao/DeptDao.java" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/dao/DeptDao.java"
new file mode 100644
index 0000000000000000000000000000000000000000..5fe43eba9657d5b953782a3adf661cd759821381
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/dao/DeptDao.java"
@@ -0,0 +1,31 @@
+package com.WJY.dao;
+
+import com.WJY.pojo.Dept;
+import org.apache.ibatis.annotations.*;
+
+import java.util.List;
+
+
+@Mapper //目的就是为了不再写mapper映射文件,这个注解用来mapper.xml文件的 使用了这个注解就要在启动类上添加@MapperScan(""Mapper接口层路径)
+public interface DeptDao {
+
+ //查询所有部门
+ @Select("select * from dept;")
+ List queryAllDept();
+
+ //根据部门id查询部门
+ @Select("select * from dept where dept_id = #{id}")
+ Dept queryDeptById(@Param("id") int id);
+
+ //增加一个部门
+ @Insert("insert into dept (dept_name) values (#{deptName})")
+ int addDept(Dept dept);
+
+ //删除一个部门
+ @Delete("delete from dept where dept_id = #{id}")
+ int delDeptById(@Param("id") int id);
+
+ //修改部门
+ @Update("update dept set dept_name = #{deptName} where dept_id = #{deptId}")
+ int updateDept(Dept dept);
+}
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/pojo/Dept.java" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/pojo/Dept.java"
new file mode 100644
index 0000000000000000000000000000000000000000..496d04074042154b7891eab63902b9ad0809e4d0
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/pojo/Dept.java"
@@ -0,0 +1,15 @@
+package com.WJY.pojo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.stereotype.Component;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+//@Component("dept") //注册实体类
+public class Dept {
+ private int deptId;
+ private String deptName;
+}
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/service/DeptService.java" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/service/DeptService.java"
new file mode 100644
index 0000000000000000000000000000000000000000..91e28e4c111a847f349a9844db9d524eac63960a
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/service/DeptService.java"
@@ -0,0 +1,27 @@
+package com.WJY.service;
+
+import com.WJY.pojo.Dept;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.List;
+
+public interface DeptService {
+
+ //查询所有部门
+ List queryAllDept();
+
+ //根据部门id查询部门
+ Dept queryDeptById(@Param("id") int id);
+
+ //增加一个部门
+ int addDept(Dept dept);
+
+ //删除一个部门
+ int delDeptById(@Param("id") int id);
+
+ //修改部门
+ int updateDept(Dept dept);
+}
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/service/DeptServiceImpl.java" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/service/DeptServiceImpl.java"
new file mode 100644
index 0000000000000000000000000000000000000000..7b741c1d61e1ea252587fd9224e228b619c3f7f5
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/java/com/WJY/service/DeptServiceImpl.java"
@@ -0,0 +1,47 @@
+package com.WJY.service;
+
+import com.WJY.dao.DeptDao;
+import com.WJY.pojo.Dept;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class DeptServiceImpl implements DeptService {
+
+ //service调Dao层
+ @Autowired
+ private DeptDao deptDao;
+
+ public void setDeptDao(DeptDao deptDao) {
+ this.deptDao = deptDao;
+ }
+
+ @Override
+ public List queryAllDept() {
+ return deptDao.queryAllDept();
+ }
+
+ @Override
+ public Dept queryDeptById(int id) {
+ return deptDao.queryDeptById(id);
+ }
+
+ @Override
+ public int addDept(Dept dept) {
+ return deptDao.addDept(dept);
+ }
+
+ @Override
+ public int delDeptById(int id) {
+ return deptDao.delDeptById(id);
+ }
+
+ @Override
+ public int updateDept(Dept dept) {
+ return deptDao.updateDept(dept);
+ }
+
+
+}
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/resources/db.txt" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/resources/db.txt"
new file mode 100644
index 0000000000000000000000000000000000000000..314ff056fb28d2f1a744bd2beca4bca4e90a5e1d
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/resources/db.txt"
@@ -0,0 +1,11 @@
+create database mx;
+use mx;
+create table dept(
+dept_id int PRIMARY key auto_increment,
+dept_name VARCHAR(20)
+);
+INSERT INTO `mx`.`dept` (`dept_name`) VALUES ('吏部');
+INSERT INTO `mx`.`dept` (`dept_name`) VALUES ('户部');
+INSERT INTO `mx`.`dept` (`dept_name`) VALUES ('刑部');
+INSERT INTO `mx`.`dept` (`dept_name`) VALUES ('尚书部');
+INSERT INTO `mx`.`dept` (`dept_name`) VALUES ('兵部');
\ No newline at end of file
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/resources/jdbc.properties" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/resources/jdbc.properties"
new file mode 100644
index 0000000000000000000000000000000000000000..f0bb637a2a64eae6b76a8bf717352fef14bcefba
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/resources/jdbc.properties"
@@ -0,0 +1,4 @@
+jdbc.driver=com.mysql.cj.jdbc.Driver
+jdbc.url=jdbc:mysql://localhost:3306/mx
+jdbc.username=root
+jdbc.password=123456
\ No newline at end of file
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/resources/mybatis-config.xml" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/resources/mybatis-config.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..08ac307473b5954f5779fe3c83b1c7c57f9b60f5
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/main/resources/mybatis-config.xml"
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\345\220\264\344\275\263\345\256\207/spring_anno/src/test/java/MyTest.java" "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/test/java/MyTest.java"
new file mode 100644
index 0000000000000000000000000000000000000000..13083195e3960a67d996b4d9a3f6421bece50f7e
--- /dev/null
+++ "b/\345\220\264\344\275\263\345\256\207/spring_anno/src/test/java/MyTest.java"
@@ -0,0 +1,26 @@
+import com.WJY.config.SpringConfig;
+
+import com.WJY.controller.DeptController;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+
+
+public class MyTest {
+
+// @Autowired
+// private DeptController dC;
+//
+// @Test
+// public void t01() {
+// dC.queryAllDeptList();
+// }
+
+
+ @Test
+ public void t1() {
+ ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
+ DeptController deptController = context.getBean(DeptController.class);
+ deptController.queryAllDeptList();
+ }
+}