xixi178 vor 7 Monaten
Ursprung
Commit
14d15ad438
42 geänderte Dateien mit 0 neuen und 1504 gelöschten Zeilen
  1. 0 33
      lab-springBoot/MybatisPlus-1/.gitignore
  2. 0 62
      lab-springBoot/MybatisPlus-1/pom.xml
  3. 0 15
      lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/MybatisPlusApplication.java
  4. 0 38
      lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/config/CreateAndUpdateMetaObjectHandler.java
  5. 0 59
      lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/config/MybatisPlusConfig.java
  6. 0 66
      lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/domain/User.java
  7. 0 19
      lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/mapper/UserMapper.java
  8. 0 16
      lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/service/IUserService.java
  9. 0 23
      lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/service/impl/UserServiceImpl.java
  10. 0 10
      lab-springBoot/MybatisPlus-1/src/main/resources/application.yml
  11. 0 25
      lab-springBoot/MybatisPlus-1/src/main/resources/mapper/UserMapper.xml
  12. 0 87
      lab-springBoot/MybatisPlus-1/src/test/java/com/xiangji/demo/MybatisPlusApplicationMapperTests.java
  13. 0 76
      lab-springBoot/MybatisPlus-1/src/test/java/com/xiangji/demo/MybatisPlusApplicationServiceTests.java
  14. 0 33
      lab-springBoot/SpringBoot-2/.gitignore
  15. 0 41
      lab-springBoot/SpringBoot-2/pom.xml
  16. 0 13
      lab-springBoot/SpringBoot-2/src/main/java/com/xiang/learn/LearnApplication.java
  17. 0 20
      lab-springBoot/SpringBoot-2/src/main/java/com/xiang/learn/controller/HelloController.java
  18. 0 1
      lab-springBoot/SpringBoot-2/src/main/resources/application.properties
  19. 0 13
      lab-springBoot/SpringBoot-2/src/test/java/com/xiang/learn/LearnApplicationTests.java
  20. 0 34
      lab-springBoot/SpringBoot-3/.gitignore
  21. 0 80
      lab-springBoot/SpringBoot-3/pom.xml
  22. 0 13
      lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/LearnApplication.java
  23. 0 19
      lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/controller/HelloController.java
  24. 0 19
      lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/controller/LogController.java
  25. 0 24
      lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/propertiesBean/PersonBean.java
  26. 0 25
      lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/propertiesBean/User1Bean.java
  27. 0 21
      lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/propertiesBean/UserBean.java
  28. 0 5
      lab-springBoot/SpringBoot-3/src/main/resources/application-dev.yml
  29. 0 6
      lab-springBoot/SpringBoot-3/src/main/resources/application-prod.yml
  30. 0 53
      lab-springBoot/SpringBoot-3/src/main/resources/application.yml
  31. 0 116
      lab-springBoot/SpringBoot-3/src/main/resources/log4j2.xml
  32. 0 101
      lab-springBoot/SpringBoot-3/src/main/resources/logback-spring.xml
  33. 0 5
      lab-springBoot/SpringBoot-3/src/main/resources/person.properties
  34. 0 27
      lab-springBoot/SpringBoot-3/src/test/java/com/xiang/learn/LearnApplicationTests.java
  35. 0 33
      lab-springBoot/SpringBoot-4/.gitignore
  36. 0 68
      lab-springBoot/SpringBoot-4/pom.xml
  37. 0 13
      lab-springBoot/SpringBoot-4/src/main/java/com/xiang/jdbc/JdbcApplication.java
  38. 0 18
      lab-springBoot/SpringBoot-4/src/main/java/com/xiang/jdbc/entity/User.java
  39. 0 47
      lab-springBoot/SpringBoot-4/src/main/java/com/xiang/jdbc/service/UserService.java
  40. 0 55
      lab-springBoot/SpringBoot-4/src/main/java/com/xiang/jdbc/service/impl/UserServiceImpl.java
  41. 0 7
      lab-springBoot/SpringBoot-4/src/main/resources/application.yml
  42. 0 65
      lab-springBoot/SpringBoot-4/src/test/java/com/xiang/jdbc/JdbcApplicationTests.java

+ 0 - 33
lab-springBoot/MybatisPlus-1/.gitignore

@@ -1,33 +0,0 @@
-HELP.md
-target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/

+ 0 - 62
lab-springBoot/MybatisPlus-1/pom.xml

@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.5.2</version>
-        <relativePath/> <!-- lookup parent from repository -->
-    </parent>
-    <groupId>com.xiangji</groupId>
-    <artifactId>demo</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
-    <name>MybatisPlus</name>
-    <description>Demo project for Spring Boot</description>
-    <properties>
-        <java.version>1.8</java.version>
-    </properties>
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-boot-starter</artifactId>
-            <version>3.4.3</version>
-        </dependency>
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>cn.hutool</groupId>
-            <artifactId>hutool-all</artifactId>
-            <version>5.7.2</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

+ 0 - 15
lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/MybatisPlusApplication.java

@@ -1,15 +0,0 @@
-package com.xiangji.demo;
-
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-@MapperScan("com.xiangji.demo.mapper")
-public class MybatisPlusApplication {
-
-    public static void main(String[] args) {
-        SpringApplication.run(MybatisPlusApplication.class, args);
-    }
-
-}

+ 0 - 38
lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/config/CreateAndUpdateMetaObjectHandler.java

@@ -1,38 +0,0 @@
-package com.xiangji.demo.config;
-
-import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.reflection.MetaObject;
-
-import java.time.LocalDateTime;
-
-/**
- * MP注入处理器
- * @author Xiangji
- * @date 2021/4/25
- */
-@Slf4j
-public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
-
-	@Override
-	public void insertFill(MetaObject metaObject) {
-		log.info("insert开始属性填充");
-		//根据属性名字设置要填充的值
-		if (metaObject.hasGetter("gmtCreate")) {
-			if (metaObject.getValue("gmtCreate") == null) {
-				this.setFieldValByName("gmtCreate", LocalDateTime.now(), metaObject);
-			}
-		}
-	}
-
-	@Override
-	public void updateFill(MetaObject metaObject) {
-		log.info("update开始属性填充");
-		if (metaObject.hasGetter("gmtModified")) {
-			if (metaObject.getValue("gmtModified") == null) {
-				this.setFieldValByName("gmtModified", LocalDateTime.now(), metaObject);
-			}
-		}
-	}
-
-}

+ 0 - 59
lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/config/MybatisPlusConfig.java

@@ -1,59 +0,0 @@
-package com.xiangji.demo.config;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
-import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
-import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
-import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * mybatis-plus配置类
- *
- * @author Xiangji
- */
-@Configuration
-public class MybatisPlusConfig {
-
-	@Bean
-	public MybatisPlusInterceptor mybatisPlusInterceptor() {
-		MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
-		// 分页插件
-		interceptor.addInnerInterceptor(paginationInnerInterceptor());
-		// 乐观锁插件
-		interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor());
-		return interceptor;
-	}
-
-	/**
-	 * 分页插件,自动识别数据库类型
-	 * https://baomidou.com/guide/interceptor-pagination.html
-	 */
-	public PaginationInnerInterceptor paginationInnerInterceptor() {
-		PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
-		// 设置数据库类型为mysql
-		paginationInnerInterceptor.setDbType(DbType.MYSQL);
-		// 设置最大单页限制数量,默认 500 条,-1 不受限制
-		paginationInnerInterceptor.setMaxLimit(-1L);
-		return paginationInnerInterceptor;
-	}
-
-	/**
-	 * 乐观锁插件
-	 * https://baomidou.com/guide/interceptor-optimistic-locker.html
-	 */
-	public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() {
-		return new OptimisticLockerInnerInterceptor();
-	}
-
-	/**
-	 * 元对象字段填充控制器
-	 * https://baomidou.com/guide/auto-fill-metainfo.html
-	 */
-	@Bean
-	public MetaObjectHandler metaObjectHandler() {
-		return new CreateAndUpdateMetaObjectHandler();
-	}
-
-}

+ 0 - 66
lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/domain/User.java

@@ -1,66 +0,0 @@
-package com.xiangji.demo.domain;
-
-import com.baomidou.mybatisplus.annotation.*;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-/**
- * <p>
-<<<<<<< HEAD
- *  用户
-=======
- * 用户
->>>>>>> master
- * </p>
- *
- * @author Xiangji
- * @since 2021-07-02
- */
-@Data
-@TableName("tbl_user")
-public class User {
-
-    /**
-     * 主键ID
-     */
-    @TableId(type = IdType.AUTO)
-    private Long id;
-
-    /**
-     * 姓名
-     */
-    private String name;
-
-    /**
-     * 年龄
-     */
-    private Integer age;
-
-    /**
-     * 邮箱
-     */
-    private String email;
-
-    /**
-     * 创建时间
-     */
-    @TableField(fill = FieldFill.INSERT)
-    private LocalDateTime gmtCreate;
-
-    /**
-     * 修改时间
-     */
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private LocalDateTime gmtModified;
-
-    /**
-     * 逻辑删除属性
-     */
-    @TableLogic
-    @TableField("is_deleted")
-    private Boolean deleted;
-
-    @Version
-    private Integer version;
-}

+ 0 - 19
lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/mapper/UserMapper.java

@@ -1,19 +0,0 @@
-package com.xiangji.demo.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xiangji.demo.domain.User;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- *  Mapper 接口
- * </p>
- *
- * @author Xiangji
- * @since 2021-07-02
- */
-public interface UserMapper extends BaseMapper<User> {
-
-    User selectFirstByName(@Param("firstName")String name);
-
-}

+ 0 - 16
lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/service/IUserService.java

@@ -1,16 +0,0 @@
-package com.xiangji.demo.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xiangji.demo.domain.User;
-
-/**
- * <p>
- *  服务类
- * </p>
- *
- * @author Xiangji
- * @since 2021-07-02
- */
-public interface IUserService extends IService<User> {
-    User queryFirstByName(String name);
-}

+ 0 - 23
lab-springBoot/MybatisPlus-1/src/main/java/com/xiangji/demo/service/impl/UserServiceImpl.java

@@ -1,23 +0,0 @@
-package com.xiangji.demo.service.impl;
-
-import com.xiangji.demo.domain.User;
-import com.xiangji.demo.mapper.UserMapper;
-import com.xiangji.demo.service.IUserService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- *  服务实现类
- * </p>
- *
- * @author Xiangji
- * @since 2021-07-02
- */
-@Service
-public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
-    @Override
-    public User queryFirstByName(String name) {
-        return baseMapper.selectFirstByName(name);
-    }
-}

+ 0 - 10
lab-springBoot/MybatisPlus-1/src/main/resources/application.yml

@@ -1,10 +0,0 @@
-spring:
-  datasource:
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://106.14.243.170:3306/test?serverTimezone=GMT%2B8
-    username: root
-    password: 0efb239460ed45e6
-
-mybatis-plus:
-  configuration:
-    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 输出SQL日志

+ 0 - 25
lab-springBoot/MybatisPlus-1/src/main/resources/mapper/UserMapper.xml

@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.xiangji.demo.mapper.UserMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.xiangji.demo.domain.User">
-        <id column="id" property="id" />
-        <result column="name" property="name" />
-        <result column="age" property="age" />
-        <result column="email" property="email" />
-    </resultMap>
-
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-        id, name, age, email
-    </sql>
-
-    <select id="selectFirstByName" resultMap="BaseResultMap">
-        select
-        <include refid="Base_Column_List"/>
-        from tbl_user
-        where `name`=#{firstName} limit 1
-    </select>
-
-</mapper>

+ 0 - 87
lab-springBoot/MybatisPlus-1/src/test/java/com/xiangji/demo/MybatisPlusApplicationMapperTests.java

@@ -1,87 +0,0 @@
-package com.xiangji.demo;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.xiangji.demo.domain.User;
-import com.xiangji.demo.mapper.UserMapper;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.List;
-
-@SpringBootTest
-class MybatisPlusApplicationMapperTests {
-
-    @Autowired
-    private UserMapper userMapper;
-
-
-    @Test
-    public void testSelect() {
-        System.out.println(("----- selectAll method test ------"));
-        List<User> userList = userMapper.selectList(null);
-        userList.forEach(System.out::println);
-    }
-
-    @Test
-    public void testAdd() {
-        System.out.println(("----- add method test ------"));
-        User user = new User();
-        user.setName("Xiangji");
-        user.setAge(18);
-        user.setEmail("test6@baomidou.com");
-        int i = userMapper.insert(user);
-        // i 返回的是插入的条数
-        // user.getId() 可以直接获取到插入后的ID值
-        System.out.println("return the number added:" + i);
-        System.out.println("return the primary key ID:" + user.getId());
-    }
-
-    @Test
-    public void testOptimisticLock() {
-        // A、B管理员读取数据
-        User A = userMapper.selectById(6L);
-        User B = userMapper.selectById(6L);
-        // B管理员先修改
-        B.setAge(15);
-        int result = userMapper.updateById(B);
-        if (result == 1) {
-            System.out.println("B管理员修改成功!");
-        } else {
-            System.out.println("B管理员修改失败!");
-        }
-        // A管理员后修改
-        A.setAge(25);
-        int result2 = userMapper.updateById(A);
-        if (result2 == 1) {
-            System.out.println("A管理员修改成功!");
-        } else {
-            System.out.println("A管理员修改失败!");
-        }
-        // 最后查询
-        System.out.println(userMapper.selectById(6L));
-    }
-
-    @Test
-    public void testQueryWrapper() {
-        // 查询名字中包含'j',年龄大于等于18岁及小于等于20岁
-        LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<User>()
-                .like(User::getName, "j")
-                .ge(User::getAge, 18)
-                .le(User::getAge, 20);
-        List<User> list = userMapper.selectList(wrapper);
-        list.forEach(System.out::println);
-    }
-
-    @Test
-    public void testUpdateWrapper() {
-        // 查询名字中包含'j',年龄大于等于18岁及小于等于20岁
-        UpdateWrapper<User> wrapper = new UpdateWrapper<User>()
-                .set("email","testUpdateWrapper@baomidou.com")
-                .like("name", "j")
-                .ge("age", 18)
-                .le("age", 20);
-        userMapper.update(null,wrapper);
-    }
-}

+ 0 - 76
lab-springBoot/MybatisPlus-1/src/test/java/com/xiangji/demo/MybatisPlusApplicationServiceTests.java

@@ -1,76 +0,0 @@
-package com.xiangji.demo;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xiangji.demo.domain.User;
-import com.xiangji.demo.service.IUserService;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.List;
-
-@SpringBootTest
-class MybatisPlusApplicationServiceTests {
-
-    @Autowired
-    private IUserService userService;
-
-    @Test
-    public void testSelectAll() {
-        List<User> user = userService.list();
-        user.forEach(System.out::println);
-    }
-
-
-    @Test
-    public void testSelect() {
-        System.out.println(("----- queryFirstByName method test ------"));
-        User user = userService.queryFirstByName("Xiangji");
-        System.out.println(user);
-    }
-
-    @Test
-    public void testPage() {
-        // 创建Page对象,参数分别对应当前页和每页显示记录数
-        Page<User> page = new Page<>(1,2);
-        // 直接调用公共 Service 的page方法,参数分别对应page对象和wrapper条件
-        userService.page(page, null);
-        // page.getRecords() 当前查询出来的分页数据集合
-        List<User> userList = page.getRecords();
-        userList.forEach(System.out::println);
-        System.out.println("获取总条数:" + page.getTotal());
-        System.out.println("获取当前页码:" + page.getCurrent());
-        System.out.println("获取总页码:" + page.getPages());
-        System.out.println("获取每页显示的数据条数:" + page.getSize());
-        System.out.println("是否有上一页:" + page.hasPrevious());
-        System.out.println("是否有下一页:" + page.hasNext());
-    }
-
-    @Test
-    public void testPageWrapper() {
-        // 创建Page对象,参数分别对应当前页和每页显示记录数
-        Page<User> page = new Page<>(1,2);
-        // 直接调用公共 Service 的page方法,参数分别对应page对象和wrapper条件
-        userService.page(page,new QueryWrapper<User>()
-                .between("age", 20, 30));
-        // page.getRecords() 当前查询出来的分页数据集合
-        List<User> userList = page.getRecords();
-        userList.forEach(System.out::println);
-    }
-
-    @Test
-    public void testRemove() {
-        userService.removeById(7);
-    }
-
-    @Test
-    public void testUpdate() {
-        User user = new User();
-        user.setId(6L);
-        user.setAge(20);
-        userService.updateById(user);
-    }
-
-
-}

+ 0 - 33
lab-springBoot/SpringBoot-2/.gitignore

@@ -1,33 +0,0 @@
-HELP.md
-target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/

+ 0 - 41
lab-springBoot/SpringBoot-2/pom.xml

@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.5.2</version>
-        <relativePath/>
-    </parent>
-    <groupId>com.xiang</groupId>
-    <artifactId>learn</artifactId>
-    <version>1.0</version>
-    <name>learn</name>
-    <description>Demo project for Spring Boot</description>
-    <properties>
-        <java.version>1.8</java.version>
-    </properties>
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

+ 0 - 13
lab-springBoot/SpringBoot-2/src/main/java/com/xiang/learn/LearnApplication.java

@@ -1,13 +0,0 @@
-package com.xiang.learn;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class LearnApplication {
-
-    public static void main(String[] args) {
-        SpringApplication.run(LearnApplication.class, args);
-    }
-
-}

+ 0 - 20
lab-springBoot/SpringBoot-2/src/main/java/com/xiang/learn/controller/HelloController.java

@@ -1,20 +0,0 @@
-package com.xiang.learn.controller;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-/**
- * @author Xiang
- * @Description
- **/
-@Controller
-public class HelloController {
-
-    @ResponseBody
-    @RequestMapping("/hello")
-    public String helloIndex(){
-        return "Hello World";
-    }
-
-}

+ 0 - 1
lab-springBoot/SpringBoot-2/src/main/resources/application.properties

@@ -1 +0,0 @@
-

+ 0 - 13
lab-springBoot/SpringBoot-2/src/test/java/com/xiang/learn/LearnApplicationTests.java

@@ -1,13 +0,0 @@
-package com.xiang.learn;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-class LearnApplicationTests {
-
-    @Test
-    void contextLoads() {
-    }
-
-}

+ 0 - 34
lab-springBoot/SpringBoot-3/.gitignore

@@ -1,34 +0,0 @@
-HELP.md
-target/
-logfile/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/

+ 0 - 80
lab-springBoot/SpringBoot-3/pom.xml

@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.5.2</version>
-        <relativePath/>
-    </parent>
-    <groupId>com.xiang</groupId>
-    <artifactId>learn</artifactId>
-    <version>1.0</version>
-    <name>learn</name>
-    <description>Demo project for Spring Boot</description>
-    <properties>
-        <java.version>1.8</java.version>
-    </properties>
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-            <!-- 切换为log4j2框架第一步:排除 spring-boot-starter-logging 日志启动器 -->
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-starter-logging</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <!-- 再添加 log4j2 日志启动器 -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-log4j2</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <!-- lombox bean 插件 -->
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <optional>true</optional>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-
-    <profiles>
-        <profile>
-            <id>dev</id>
-            <properties>
-                <!-- 环境标识,需要与配置文件的名称相对应 -->
-                <profiles.active>dev</profiles.active>
-            </properties>
-            <activation>
-                <!-- 默认环境 -->
-                <activeByDefault>true</activeByDefault>
-            </activation>
-        </profile>
-        <profile>
-            <id>prod</id>
-            <properties>
-                <profiles.active>prod</profiles.active>
-            </properties>
-        </profile>
-    </profiles>
-
-</project>

+ 0 - 13
lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/LearnApplication.java

@@ -1,13 +0,0 @@
-package com.xiang.learn;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class LearnApplication {
-
-    public static void main(String[] args) {
-        SpringApplication.run(LearnApplication.class, args);
-    }
-
-}

+ 0 - 19
lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/controller/HelloController.java

@@ -1,19 +0,0 @@
-package com.xiang.learn.controller;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-
-@Controller
-@Slf4j
-public class HelloController {
-
-    @ResponseBody
-    @RequestMapping("/hello")
-    public String helloIndex(){
-        return "Hello Xiang!!!";
-    }
-
-}

+ 0 - 19
lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/controller/LogController.java

@@ -1,19 +0,0 @@
-package com.xiang.learn.controller;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-@RestController
-@Slf4j
-public class LogController {
-
-    @RequestMapping("/log")
-    public void logIndex(){
-        log.trace("Trace 日志...");
-        log.debug("Debug 日志...");
-        log.info("Info 日志...");
-        log.warn("Warn 日志...");
-        log.error("Error 日志...");
-    }
-
-}

+ 0 - 24
lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/propertiesBean/PersonBean.java

@@ -1,24 +0,0 @@
-package com.xiang.learn.propertiesBean;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.PropertySource;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Wilbur
- **/
-@Data
-@Configuration
-@ConfigurationProperties(prefix = "person")
-@PropertySource(value = "classpath:person.properties")
-public class PersonBean {
-    private String lastName;
-    private Integer age;
-    private Map<String,String> maps;
-    private List<Integer> list;
-
-}

+ 0 - 25
lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/propertiesBean/User1Bean.java

@@ -1,25 +0,0 @@
-package com.xiang.learn.propertiesBean;
-
-import lombok.Data;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Xiang
- **/
-@Data
-@Component
-//@ConfigurationProperties(prefix = "user")
-public class User1Bean {
-    @Value("${user1.lastName}")
-    private String lastName;
-    @Value("${user1.age}")
-    private Integer age;
-    @Value("#{${user1.maps}}")
-    private Map<String,String> maps;
-    @Value("#{'${user1.list}'.split(',')}")
-    private List<Integer> list;
-}

+ 0 - 21
lab-springBoot/SpringBoot-3/src/main/java/com/xiang/learn/propertiesBean/UserBean.java

@@ -1,21 +0,0 @@
-package com.xiang.learn.propertiesBean;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Xiang
- **/
-@Data
-@Component
-@ConfigurationProperties(prefix = "user")
-public class UserBean {
-    private String lastName;
-    private Integer age;
-    private Map<String,String> maps;
-    private List<Integer> list;
-}

+ 0 - 5
lab-springBoot/SpringBoot-3/src/main/resources/application-dev.yml

@@ -1,5 +0,0 @@
-
-
-user:
-  age: 20
-

+ 0 - 6
lab-springBoot/SpringBoot-3/src/main/resources/application-prod.yml

@@ -1,6 +0,0 @@
-
-
-
-user:
-  age: 25
-

+ 0 - 53
lab-springBoot/SpringBoot-3/src/main/resources/application.yml

@@ -1,53 +0,0 @@
-
-
-logging:
-  level:
-#    root: trace #设置root级别
-#    com.xiang.log: trace  # 当前项目工程没有这个包,假设的一个
-    com.xiang.learn: trace # com.xiang.learn 包下的级别
-  config: classpath:log4j2.xml
-
-  # 配置了 logback-spring.xml或者log4j2.xml文件 可以注释掉下面配置
-  file:
-#    path: E:\my-tool\log # 生成指定目录日志文件 ( linux系统 /data/log )
-#    path: logfile # 生成当前项目根目录日志文件
-    name: logfile/my.log
-  logback:
-    rollingpolicy:
-      max-file-size: 500KB  # 默认10MB 日志文件大小切割,超过指定数问自动打包成gz文件
-      max-history: 2 # 默认7天 日志的保留时间,超过指定数会自动删除
-  pattern:
-    console: '%d{yyyy-MM-dd} [%thread] %clr(%-5level) %clr(%logger{50}){cyan} - %msg%n'
-    file: '%d{yyyy-MM-dd HH:mm:ss.SSS} >>> [%thread] >>> %-5level >>> %logger{50} >>> %msg%n'
-
-spring:
-  profiles:
-    active: dev
-#    active: '@profiles.active@'
-
-
-# UserBean @ConfigurationProperties 写法
-user:
-  lastName: Xiang
-  age: 18
-  list:
-    - 1
-    - 2
-    - 3
-  maps:
-    key1: value1
-    key2: value2
-
-
-
-
-
-
-
-
-# User1Bean @Value 写法
-user1:
-  lastName: Xiang
-  age: 18
-  list: 1,2,3
-  maps: '{"key1":"value1","key2":"value2"}'

+ 0 - 116
lab-springBoot/SpringBoot-3/src/main/resources/log4j2.xml

@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--Configuration后面的status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出 -->
-<!--monitorInterval:Log4j能够自动检测修改配置 文件和重新配置本身,设置间隔秒数 -->
-<configuration monitorInterval="5">
-    <!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
-
-
-    <!--变量配置 -->
-    <Properties>
-        <!-- 格式化输出:%date表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %msg:日志消息,%n是换行符 -->
-        <!-- %logger{36} 表示 Logger 名字最长36个字符 -->
-        <property name="LOG_PATTERN"
-                  value="%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{%5p} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n%xwEx" />
-        <Property name="FILE_PATTERN">%date{yyy-MM-dd HH:mm:ss.SSS} %5p ${sys:PID}} --- [%15.15t] %-40.40c{1.}{cyan} : %m%n%xwEx</Property>
-
-        <!-- 定义日志存储的路径,不要配置相对路径 -->
-        <property name="FILE_PATH" value="./logfile" />
-        <property name="FILE_NAME" value="springboot-log" />
-    </Properties>
-
-
-    <appenders>
-
-        <!-- 控制台配置输出  -->
-        <console name="Console" target="SYSTEM_OUT">
-            <!--输出日志的格式 -->
-            <PatternLayout pattern="${LOG_PATTERN}" />
-            <!--控制台只输出level及其以上级别的信息(onMatch),其他的直接拒绝(onMismatch) -->
-            <ThresholdFilter level="DEBUG" onMatch="ACCEPT"
-                             onMismatch="DENY" />
-        </console>
-
-        <!-- 这个会打印出所有的info及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档 -->
-        <RollingFile name="RollingFileInfo"
-                     fileName="${FILE_PATH}/info.log"
-                     filePattern="${FILE_PATH}/${FILE_NAME}-INFO-%d{yyyy-MM-dd}_%i.log.gz">
-            <!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch) -->
-            <ThresholdFilter level="info" onMatch="ACCEPT"
-                             onMismatch="DENY" />
-            <PatternLayout pattern="${FILE_PATTERN}" />
-            <Policies>
-                <!--interval属性用来指定多久滚动一次,默认是1 hour -->
-                <TimeBasedTriggeringPolicy interval="1" />
-                <SizeBasedTriggeringPolicy size="10MB" />
-            </Policies>
-            <!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件开始覆盖 -->
-            <DefaultRolloverStrategy max="15" />
-        </RollingFile>
-
-
-        <!-- 这个会打印出所有的warn及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档 -->
-        <RollingFile name="RollingFileWarn"
-                     fileName="${FILE_PATH}/warn.log"
-                     filePattern="${FILE_PATH}/${FILE_NAME}-WARN-%d{yyyy-MM-dd}_%i.log.gz">
-            <!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch) -->
-            <ThresholdFilter level="warn" onMatch="ACCEPT"
-                             onMismatch="DENY" />
-            <PatternLayout pattern="${FILE_PATTERN}" />
-            <Policies>
-                <!--interval属性用来指定多久滚动一次,默认是1 hour -->
-                <TimeBasedTriggeringPolicy interval="1" />
-                <SizeBasedTriggeringPolicy size="10MB" />
-            </Policies>
-            <!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件开始覆盖 -->
-            <DefaultRolloverStrategy max="15" />
-        </RollingFile>
-
-
-        <!-- 这个会打印出所有的error及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档 -->
-        <RollingFile name="RollingFileError"
-                     fileName="${FILE_PATH}/error.log"
-                     filePattern="${FILE_PATH}/${FILE_NAME}-ERROR-%d{yyyy-MM-dd}_%i.log.gz">
-            <!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch) -->
-            <ThresholdFilter level="error" onMatch="ACCEPT"
-                             onMismatch="DENY" />
-            <PatternLayout pattern="${FILE_PATTERN}" />
-            <Policies>
-                <!--interval属性用来指定多久滚动一次,默认是1 hour -->
-                <TimeBasedTriggeringPolicy interval="1" />
-                <SizeBasedTriggeringPolicy size="10MB" />
-            </Policies>
-            <!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件开始覆盖 -->
-            <DefaultRolloverStrategy max="15" />
-        </RollingFile>
-
-
-    </appenders>
-
-
-    <!--Logger节点用来单独指定日志的形式,比如要为指定包下的class指定不同的日志级别等。 -->
-    <!--然后定义loggers,只有定义了logger并引入的appender,appender才会生效 -->
-    <loggers>
-
-
-        <!--过滤掉spring和mybatis的一些无用的DEBUG信息 -->
-        <logger name="org.mybatis" level="info" additivity="false">
-            <AppenderRef ref="Console" />
-        </logger>
-        <!--监控系统信息 -->
-        <!--若是additivity设为false,则 子Logger 只会在自己的appender里输出,而不会在 父Logger 的appender里输出。 -->
-        <Logger name="org.springframework" level="info"
-                additivity="false">
-            <AppenderRef ref="Console" />
-        </Logger>
-
-
-        <root level="info">
-            <appender-ref ref="Console" />
-            <appender-ref ref="RollingFileInfo" />
-            <appender-ref ref="RollingFileWarn" />
-            <appender-ref ref="RollingFileError" />
-        </root>
-    </loggers>
-
-
-</configuration>

+ 0 - 101
lab-springBoot/SpringBoot-3/src/main/resources/logback-spring.xml

@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。
-scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒当scan为true时,此属性生效。默认的时间间隔为1分钟。
-debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。
--->
-<configuration scan="false" scanPeriod="60 seconds" debug="false">
-    <!-- 定义日志存放路径为当前项目根目录 -->
-    <property name="LOG_HOME" value="./logfile" />
-    <!-- 定义日志文件名称 -->
-    <property name="appName" value="springboot-learn"></property>
-
-
-
-    <!-- 彩色日志依赖的渲染类 -->
-    <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
-
-    <!--  控制台彩色日志 dev  -->
-    <property name="console.log.pattern.dev"
-              value="%d{yyyy-MM-dd HH:mm:ss.SSS} - [%thread] - %clr(%-5level) - %clr(%logger{50}){cyan} - %msg%n"/>
-    <!--  控制台彩色日志 !dev  -->
-    <property name="console.log.pattern.prod"
-              value="%d{yyyy-MM-dd HH:mm:ss.SSS} >>> [%thread] >>> %clr(%-5level) >>> %clr(%logger{50}){cyan} >>> %msg%n"/>
-    <!--  文件日志  -->
-    <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [ %thread ] - [ %-5level ] [ %logger{50} : %line ] - %msg%n"/>
-
-    <!-- ch.qos.logback.core.ConsoleAppender 表示控制台输出 -->
-    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
-        <!--
-        日志输出格式说明:
-        %d 输出日期时间
-        %thread 输出当前线程名
-        %-5level 输出日志级别,左对齐5个字符宽度
-        %logger{50} 输出全类名最长50个字符,超过按照句点分割
-        %msg 日志信息
-        %n 换行符
-        -->
-        <layout class="ch.qos.logback.classic.PatternLayout">
-            <springProfile name="dev">
-                <pattern>${console.log.pattern.dev}</pattern>
-            </springProfile>
-            <springProfile name="!dev">
-                <pattern>${console.log.pattern.prod}</pattern>
-            </springProfile>
-        </layout>
-    </appender>
-    <!-- 滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 -->
-    <appender name="appLogAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <!-- 指定日志文件的名称 -->
-        <file>${LOG_HOME}/${appName}.log</file>
-        <!--
-        当发生滚动时,决定 RollingFileAppender 的行为,涉及文件移动和重命名
-        TimeBasedRollingPolicy: 最常用的滚动策略,它根据时间来制定滚动策略,既负责滚动也负责出发滚动。
-        -->
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <!--
-            滚动时产生的文件的存放位置及文件名称 %d{yyyy-MM-dd}:按天进行日志滚动
-            %i:当文件大小超过maxFileSize时,按照i进行文件滚动
-            -->
-            <fileNamePattern>${LOG_HOME}/${appName}-%d{yyyy-MM-dd}-%i.log</fileNamePattern>
-            <!--
-            可选节点,控制保留的归档文件的最大数量,超出数量就删除旧文件。
-            假设设置每天滚动,且maxHistory是100,则只保存最近100天的文件,删除之前的旧文件。
-            注意,删除旧文件是,那些为了归档而创建的目录也会被删除。
-            -->
-            <MaxHistory>100</MaxHistory>
-            <!--
-            当日志文件超过maxFileSize指定的大小是,根据上面提到的%i进行日志文件滚动 注意此处配置
-            SizeBasedTriggeringPolicy是无法实现按文件大小进行滚动的,必须配置timeBasedFileNamingAndTriggeringPolicy
-            -->
-            <timeBasedFileNamingAndTriggeringPolicy
-                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <maxFileSize>100MB</maxFileSize>
-            </timeBasedFileNamingAndTriggeringPolicy>
-        </rollingPolicy>
-        <!-- 日志输出格式: -->
-        <layout class="ch.qos.logback.classic.PatternLayout">
-            <pattern>${log.pattern}</pattern>
-        </layout>
-    </appender>
-    <!--
-    logger主要用于存放日志对象,也可以定义日志类型、级别
-    name:表示匹配的logger类型前缀,也就是包的前半部分
-    level:要记录的日志级别,包括 TRACE < DEBUG < INFO < WARN < ERROR
-    additivity:作用在于children-logger是否使用 rootLogger配置的appender进行输出,
-    false:表示只用当前logger的appender-ref,true:
-    表示当前logger的appender-ref和rootLogger的appender-ref都有效
-    -->
-    <!-- 系统业务 logger -->
-    <logger name="com.xiang" level="debug" />
-    <!-- Spring framework logger -->
-    <logger name="org.springframework" level="warn" additivity="false"></logger>
-    <!--
-    root与logger是父子关系,没有特别定义则默认为root,任何一个类只会和一个logger对应,
-    要么是定义的logger,要么是root,判断的关键在于找到这个logger,然后判断这个logger的appender和level。
-    -->
-    <root level="info">
-        <appender-ref ref="stdout" />
-        <appender-ref ref="appLogAppender" />
-    </root>
-</configuration>

+ 0 - 5
lab-springBoot/SpringBoot-3/src/main/resources/person.properties

@@ -1,5 +0,0 @@
-person.lastName=Xiang
-person.age=22
-person.list=1,2,3
-person.maps.key1=value1
-person.maps.key2=value2

+ 0 - 27
lab-springBoot/SpringBoot-3/src/test/java/com/xiang/learn/LearnApplicationTests.java

@@ -1,27 +0,0 @@
-package com.xiang.learn;
-
-import com.xiang.learn.propertiesBean.PersonBean;
-import com.xiang.learn.propertiesBean.User1Bean;
-import com.xiang.learn.propertiesBean.UserBean;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-class LearnApplicationTests {
-
-    @Autowired
-    UserBean userBean;
-//    @Autowired
-//    User1Bean user1Bean;
-//    @Autowired
-//    PersonBean personBean;
-
-    @Test
-    void contextLoads() {
-        System.out.println(userBean);
-//        System.out.println(user1Bean);
-//        System.out.println(personBean);
-    }
-
-}

+ 0 - 33
lab-springBoot/SpringBoot-4/.gitignore

@@ -1,33 +0,0 @@
-HELP.md
-target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/

+ 0 - 68
lab-springBoot/SpringBoot-4/pom.xml

@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.5.3</version>
-        <relativePath/> <!-- lookup parent from repository -->
-    </parent>
-    <groupId>com.xiang</groupId>
-    <artifactId>jdbc</artifactId>
-    <version>1.0</version>
-    <name>jdbc</name>
-    <description>翔基博客学习项目demo</description>
-    <properties>
-        <java.version>1.8</java.version>
-    </properties>
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-jdbc</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <configuration>
-                    <excludes>
-                        <exclude>
-                            <groupId>org.projectlombok</groupId>
-                            <artifactId>lombok</artifactId>
-                        </exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

+ 0 - 13
lab-springBoot/SpringBoot-4/src/main/java/com/xiang/jdbc/JdbcApplication.java

@@ -1,13 +0,0 @@
-package com.xiang.jdbc;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class JdbcApplication {
-
-    public static void main(String[] args) {
-        SpringApplication.run(JdbcApplication.class, args);
-    }
-
-}

+ 0 - 18
lab-springBoot/SpringBoot-4/src/main/java/com/xiang/jdbc/entity/User.java

@@ -1,18 +0,0 @@
-package com.xiang.jdbc.entity;
-
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * @author Xiang
- * @Description
- * @create 2021-08-10 11:03
- **/
-@Data
-@NoArgsConstructor
-public class User {
-
-    private String name;
-    private Integer age;
-
-}

+ 0 - 47
lab-springBoot/SpringBoot-4/src/main/java/com/xiang/jdbc/service/UserService.java

@@ -1,47 +0,0 @@
-package com.xiang.jdbc.service;
-
-import com.xiang.jdbc.entity.User;
-
-import java.util.List;
-
-/**
- * @author Xiang
- * @Description
- * @create 2021-08-10 11:15
- **/
-public interface UserService {
-
-    /**
-     * 新增一个用户
-     *
-     * @param name
-     * @param age
-     */
-    int create(String name, Integer age);
-
-    /**
-     * 根据name查询用户
-     *
-     * @param name
-     * @return
-     */
-    List<User> getByName(String name);
-
-    /**
-     * 根据name删除用户
-     *
-     * @param name
-     */
-    int deleteByName(String name);
-
-    /**
-     * 获取用户总量
-     */
-    int getAllUsers();
-
-    /**
-     * 删除所有用户
-     */
-    int deleteAllUsers();
-
-}

+ 0 - 55
lab-springBoot/SpringBoot-4/src/main/java/com/xiang/jdbc/service/impl/UserServiceImpl.java

@@ -1,55 +0,0 @@
-package com.xiang.jdbc.service.impl;
-
-import com.xiang.jdbc.entity.User;
-import com.xiang.jdbc.service.UserService;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * @author Xiang
- * @Description
- * @create 2021-08-10 11:16
- **/
-@Service
-public class UserServiceImpl implements UserService {
-
-    private JdbcTemplate jdbcTemplate;
-
-    UserServiceImpl(JdbcTemplate jdbcTemplate) {
-        this.jdbcTemplate = jdbcTemplate;
-    }
-
-    @Override
-    public int create(String name, Integer age) {
-        return jdbcTemplate.update("insert into USER(NAME, AGE) values(?, ?)", name, age);
-    }
-
-    @Override
-    public List<User> getByName(String name) {
-        List<User> users = jdbcTemplate.query("select NAME, AGE from USER where NAME = ?", (resultSet, i) -> {
-            User user = new User();
-            user.setName(resultSet.getString("NAME"));
-            user.setAge(resultSet.getInt("AGE"));
-            return user;
-        }, name);
-        return users;
-    }
-
-    @Override
-    public int deleteByName(String name) {
-        return jdbcTemplate.update("delete from USER where NAME = ?", name);
-    }
-
-    @Override
-    public int getAllUsers() {
-        return jdbcTemplate.queryForObject("select count(1) from USER", Integer.class);
-    }
-
-    @Override
-    public int deleteAllUsers() {
-        return jdbcTemplate.update("delete from USER");
-    }
-
-}

+ 0 - 7
lab-springBoot/SpringBoot-4/src/main/resources/application.yml

@@ -1,7 +0,0 @@
-
-spring:
-  datasource:
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://localhost:3306/springboot_learn?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
-    username: root
-    password: 123456

+ 0 - 65
lab-springBoot/SpringBoot-4/src/test/java/com/xiang/jdbc/JdbcApplicationTests.java

@@ -1,65 +0,0 @@
-package com.xiang.jdbc;
-
-import com.xiang.jdbc.entity.User;
-import com.xiang.jdbc.service.UserService;
-import org.junit.Assert;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.List;
-
-@SpringBootTest
-class JdbcApplicationTests {
-
-    //注入数据源
-    @Autowired
-    DataSource dataSource;
-
-    @Autowired
-    private UserService userSerivce;
-
-    @Test
-    void contextLoads()  throws SQLException {
-        //看一下默认数据源
-        System.out.println(dataSource.getClass());
-        //获得连接
-        Connection connection = dataSource.getConnection();
-        System.out.println(connection);
-        //关闭连接
-        connection.close();
-    }
-
-    @Test
-    public void test() throws Exception {
-        // 准备,清空user表
-        userSerivce.deleteAllUsers();
-
-        // 插入5个用户
-        userSerivce.create("User1", 11);
-        userSerivce.create("User2", 13);
-        userSerivce.create("User3", 36);
-        userSerivce.create("User4", 19);
-        userSerivce.create("User5", 18);
-
-        // 查询名为User1的用户,判断年龄是否匹配
-        List<User> userList = userSerivce.getByName("User1");
-        Assert.assertEquals(11, userList.get(0).getAge().intValue());
-
-        // 查数据库,应该有5个用户
-        Assert.assertEquals(5, userSerivce.getAllUsers());
-
-        // 删除两个用户
-        userSerivce.deleteByName("User4");
-        userSerivce.deleteByName("User5");
-
-        // 查数据库,应该有3个用户
-        Assert.assertEquals(3, userSerivce.getAllUsers());
-
-    }
-
-
-}