From 4f9552b5cb92fdf9bf198b5eb67fbbcb209f5189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=95=E6=A3=8D=E8=AD=A6=E5=AE=98?= <14885587+law-stick-officer@user.noreply.gitee.com> Date: Sat, 8 Nov 2025 07:07:50 +0000 Subject: [PATCH] add study-springboot-chapter01. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 法棍警官 <14885587+law-stick-officer@user.noreply.gitee.com> --- study-springboot-chapter01 | 0 study-springboot-chapter01/pom.xml | 48 ------------ .../java/cn/hniu/utils/DateUtils_12dr.java | 19 ----- .../java/cn/hniu/utils/DateUtils_hhf41.java | 16 ---- .../java/cn/hniu/utils/DateUtils_zengjl.java | 4 - .../java/cn/hniu/utils/DateUtils_zhujw.java | 20 ----- .../cn/hniu/utils/Dateutils_licongcong.java | 16 ---- .../StudySpringbootChapter01Application.java | 14 ---- .../springboot/config/CustomProperties.java | 48 ------------ .../springboot/config/CustomValue.java | 34 --------- .../springboot/config/HomeProperties.java | 62 ---------------- .../springboot/config/UserProperties.java | 74 ------------------- .../springboot/web/HelloWorldController.java | 22 ------ .../com/hniu/utils/DateUtils_huanghf41.java | 16 ---- .../main/resources/application-dev.properties | 21 ------ .../resources/application-prod.properties | 15 ---- .../src/main/resources/application.properties | 2 - .../src/main/resources/application.yml | 32 -------- .../resources/config/customconfig.properties | 5 -- .../src/main/resources/logback-spring.xml | 52 ------------- .../springboot/property/CustomConfigTest.java | 33 --------- .../springboot/property/HomeProperties1.java | 64 ---------------- .../springboot/property/PropertiesTest.java | 40 ---------- .../web/HelloWorldControllerTest.java | 18 ----- .../src/test/resouorces/application.yml | 23 ------ .../src/test/resources/application.yml | 17 ----- 26 files changed, 715 deletions(-) create mode 100644 study-springboot-chapter01 delete mode 100644 study-springboot-chapter01/pom.xml delete mode 100644 study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_12dr.java delete mode 100644 study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_hhf41.java delete mode 100644 study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_zengjl.java delete mode 100644 study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_zhujw.java delete mode 100644 study-springboot-chapter01/src/main/java/cn/hniu/utils/Dateutils_licongcong.java delete mode 100644 study-springboot-chapter01/src/main/java/com/cbitedu/springboot/StudySpringbootChapter01Application.java delete mode 100644 study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/CustomProperties.java delete mode 100644 study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/CustomValue.java delete mode 100644 study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/HomeProperties.java delete mode 100644 study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/UserProperties.java delete mode 100644 study-springboot-chapter01/src/main/java/com/cbitedu/springboot/web/HelloWorldController.java delete mode 100644 study-springboot-chapter01/src/main/java/com/hniu/utils/DateUtils_huanghf41.java delete mode 100644 study-springboot-chapter01/src/main/resources/application-dev.properties delete mode 100644 study-springboot-chapter01/src/main/resources/application-prod.properties delete mode 100644 study-springboot-chapter01/src/main/resources/application.properties delete mode 100644 study-springboot-chapter01/src/main/resources/application.yml delete mode 100644 study-springboot-chapter01/src/main/resources/config/customconfig.properties delete mode 100644 study-springboot-chapter01/src/main/resources/logback-spring.xml delete mode 100644 study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/CustomConfigTest.java delete mode 100644 study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/HomeProperties1.java delete mode 100644 study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/PropertiesTest.java delete mode 100644 study-springboot-chapter01/src/test/java/com/cbitedu/springboot/web/HelloWorldControllerTest.java delete mode 100644 study-springboot-chapter01/src/test/resouorces/application.yml delete mode 100644 study-springboot-chapter01/src/test/resources/application.yml diff --git a/study-springboot-chapter01 b/study-springboot-chapter01 new file mode 100644 index 0000000..e69de29 diff --git a/study-springboot-chapter01/pom.xml b/study-springboot-chapter01/pom.xml deleted file mode 100644 index 80018f4..0000000 --- a/study-springboot-chapter01/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - 4.0.0 - - com.cbitedu - study-springboot - 1.0.0 - - com.cbitedu - study-springboot-chapter01 - 1.0.0 - study-springboot-chapter01 - study-springboot-chapter01 - jar - - 1.8 - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - - - jdk18 - - true - 1.8 - - - 1.8 - 1.8 - 1.8 - - - - diff --git a/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_12dr.java b/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_12dr.java deleted file mode 100644 index d69f3e6..0000000 --- a/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_12dr.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.hniu.utils; - -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; - -//12 -public class DateUtils_12dr { - private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; - private static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - - /** - * 获取当前日期字符串 - */ - public static String getCurrentDate() { - System.out.println("解决冲突_12dr"); - return LocalDate.now().format(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)); - } -} - diff --git a/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_hhf41.java b/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_hhf41.java deleted file mode 100644 index fbb4838..0000000 --- a/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_hhf41.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.hniu.utils; - -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; - -public class DateUtils_hhf41 { - private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; - private static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - - /** - * 获取当前日期字符串 - */ - public static String getCurrentDate() { - return LocalDate.now().format(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)); - } -} diff --git a/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_zengjl.java b/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_zengjl.java deleted file mode 100644 index 9e1c120..0000000 --- a/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_zengjl.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.hniu.utils; - -public class DateUtils_zengjl { -} diff --git a/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_zhujw.java b/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_zhujw.java deleted file mode 100644 index a41aa61..0000000 --- a/study-springboot-chapter01/src/main/java/cn/hniu/utils/DateUtils_zhujw.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.hniu.utils; - -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; - -public class DateUtils_zhujw { - private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; - private static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - - /** - * 获取当前日期字符串 - */ - public static String getCurrentDate() { - System.out.println("解决冲突_dr_dadfasfdsadf1");System.out.println("解决冲突_dr_dadf444444asfdsadf1"); - System.out.println("解决冲突——zhujw4545");System.out.println("解决冲突_dr_dadfasfdsadf1"); - System.out.println("abcdefg"); - System.out.println("解决冲突_zhu7237"); - return LocalDate.now().format(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)); - } -} diff --git a/study-springboot-chapter01/src/main/java/cn/hniu/utils/Dateutils_licongcong.java b/study-springboot-chapter01/src/main/java/cn/hniu/utils/Dateutils_licongcong.java deleted file mode 100644 index 4789182..0000000 --- a/study-springboot-chapter01/src/main/java/cn/hniu/utils/Dateutils_licongcong.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.hniu.utils; - -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; - -public class Dateutils_licongcong { - private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; - private static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - - /** - * 获取当前日期字符串 - */ - public static String getCurrentDate() { - return LocalDate.now().format(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)); - } -} diff --git a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/StudySpringbootChapter01Application.java b/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/StudySpringbootChapter01Application.java deleted file mode 100644 index 2702032..0000000 --- a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/StudySpringbootChapter01Application.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.cbitedu.springboot; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; - -@SpringBootApplication(exclude= DataSourceAutoConfiguration.class) -public class StudySpringbootChapter01Application { - - public static void main(String[] args) { - SpringApplication.run(StudySpringbootChapter01Application.class, args); - } - -} diff --git a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/CustomProperties.java b/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/CustomProperties.java deleted file mode 100644 index 4d40927..0000000 --- a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/CustomProperties.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.cbitedu.springboot.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; - -@Configuration//保证该类会被扫描到 -@PropertySource("classpath:config/customconfig.properties") //定义了要读取的properties文件的位置 -@ConfigurationProperties(prefix = "config")//读取前缀为config 的内容 -public class CustomProperties { - private String picPath; - - @Override - public String toString() { - return "CustomProperties{" + - "picPath='" + picPath + '\'' + - ", videoPath='" + videoPath + '\'' + - ", serverDomain='" + serverDomain + '\'' + - '}'; - } - - public String getPicPath() { - return picPath; - } - - public void setPicPath(String picPath) { - this.picPath = picPath; - } - - public String getVideoPath() { - return videoPath; - } - - public void setVideoPath(String videoPath) { - this.videoPath = videoPath; - } - - public String getServerDomain() { - return serverDomain; - } - - public void setServerDomain(String serverDomain) { - this.serverDomain = serverDomain; - } - - private String videoPath; - private String serverDomain; -} diff --git a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/CustomValue.java b/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/CustomValue.java deleted file mode 100644 index a3a5c5a..0000000 --- a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/CustomValue.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.cbitedu.springboot.config; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; - -@Configuration//保证该类会被扫描到 -@PropertySource("classpath:config/customconfig.properties") //定义了要读取的properties文件的位置 -public class CustomValue { - @Override - public String toString() { - return "CustomValue{" + - "picPath='" + picPath + '\'' + - ", videoPath='" + videoPath + '\'' + - ", serverDomain='" + serverDomain + '\'' + - '}'; - } - - public String getPicPath() { - return picPath; - } - - public void setPicPath(String picPath) { - this.picPath = picPath; - } - - @Value("${config.picpath}") - private String picPath; - @Value("${config.videopath}") - private String videoPath; - @Value("${config.serverdomain}") - private String serverDomain; - -} diff --git a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/HomeProperties.java b/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/HomeProperties.java deleted file mode 100644 index a041d3a..0000000 --- a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/HomeProperties.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.cbitedu.springboot.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * 家乡属性 - * - * Created by cbitedu on 17/04/2021. - */ -@Component -@ConfigurationProperties(prefix = "home") -public class HomeProperties { - - /** - * 省份 - */ - private String province; - - /** - * 城市 - */ - private String city; - - /** - * 描述 - */ - private String desc; - - public String getProvince() { - return province; - } - - public void setProvince(String province) { - this.province = province; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - @Override - public String toString() { - return "HomeProperties{" + - "province='" + province + '\'' + - ", city='" + city + '\'' + - ", desc='" + desc + '\'' + - '}'; - } -} diff --git a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/UserProperties.java b/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/UserProperties.java deleted file mode 100644 index 4bc6e15..0000000 --- a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/config/UserProperties.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.cbitedu.springboot.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * Created by cbitedu on 17/04/2021. - */ -@Component -@ConfigurationProperties(prefix = "user") -public class UserProperties { - /** - * 用户 ID - */ - private Long id; - - /** - * 年龄 - */ - private int age; - - /** - * 用户名称 - */ - private String desc; - - /** - * 用户 UUID - */ - private String uuid; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - - @Override - public String toString() { - return "UserProperties{" + - "id=" + id + - ", age=" + age + - ", desc='" + desc + '\'' + - ", uuid='" + uuid + '\'' + - '}'; - } -} diff --git a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/web/HelloWorldController.java b/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/web/HelloWorldController.java deleted file mode 100644 index bb9fa50..0000000 --- a/study-springboot-chapter01/src/main/java/com/cbitedu/springboot/web/HelloWorldController.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.cbitedu.springboot.web; - -import ch.qos.logback.classic.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * Spring Boot HelloWorld 案例 - * - * Created by cbitedu on 17/04/2021. - */ -@RestController -public class HelloWorldController { -private final Logger logger = (Logger) LoggerFactory.getLogger(getClass()); - @RequestMapping("/") - public String sayHello() { - // System.out.println("99999999!"); - logger.info("99999999!"); - return "Hello,World!"; - } -} diff --git a/study-springboot-chapter01/src/main/java/com/hniu/utils/DateUtils_huanghf41.java b/study-springboot-chapter01/src/main/java/com/hniu/utils/DateUtils_huanghf41.java deleted file mode 100644 index e72793a..0000000 --- a/study-springboot-chapter01/src/main/java/com/hniu/utils/DateUtils_huanghf41.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hniu.utils; - -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; - -public class DateUtils_huanghf41 { - private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; - private static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - - /** - * 获取当前日期字符串 - */ - public static String getCurrentDate() { - return LocalDate.now().format(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)); - } -} diff --git a/study-springboot-chapter01/src/main/resources/application-dev.properties b/study-springboot-chapter01/src/main/resources/application-dev.properties deleted file mode 100644 index d522df3..0000000 --- a/study-springboot-chapter01/src/main/resources/application-dev.properties +++ /dev/null @@ -1,21 +0,0 @@ -##SpringBoot\u5185\u7F6E\u5C5E\u6027\u67E5\u8BE2 -##https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties -##\u5B98\u65B9\u6587\u6863\u4E2D\u53C2\u8003\u6587\u6863\u7B2C\u4E00\u9879\uFF1AApplication Properties -##\u4FEE\u6539\u670D\u52A1\u5668\u7AEF\u53E3 -server.port=8081 -server.servlet.context-path=/ -##\u5173\u95ED\u8FD0\u884C\u65E5\u5FD7\u56FE\u6807\uFF08banner\uFF09 -spring.main.banner-mode=off -##\u8BBE\u7F6E\u65E5\u5FD7\u76F8\u5173 -logging.level.root=info -logging.level.com.cbitedu=info -spring.datasource.url=jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=UTF-8&useSSL=false -## \u5BB6\u4E61\u5C5E\u6027 Dev -home.province=\u6E56\u5357\u7701 -home.city=\u957F\u6C99\u5E02 -home.desc=dev: \u7C4D\u8D2F\u6240\u5728\u5730\u4E3A${home.province} ${home.city}. -user.age=28 -user.desc=\u5F20\u4E09 - - - diff --git a/study-springboot-chapter01/src/main/resources/application-prod.properties b/study-springboot-chapter01/src/main/resources/application-prod.properties deleted file mode 100644 index 142faa3..0000000 --- a/study-springboot-chapter01/src/main/resources/application-prod.properties +++ /dev/null @@ -1,15 +0,0 @@ -##SpringBoot\u5185\u7F6E\u5C5E\u6027\u67E5\u8BE2 -##https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties -##\u5B98\u65B9\u6587\u6863\u4E2D\u53C2\u8003\u6587\u6863\u7B2C\u4E00\u9879\uFF1AApplication Properties -##\u4FEE\u6539\u670D\u52A1\u5668\u7AEF\u53E3 -server.port=80 -##\u5173\u95ED\u8FD0\u884C\u65E5\u5FD7\u56FE\u6807\uFF08banner\uFF09 -spring.main.banner-mode=off -##\u8BBE\u7F6E\u65E5\u5FD7\u76F8\u5173 -logging.level.root=error -## \u5BB6\u4E61\u5C5E\u6027 Dev -home.province=\u5E7F\u4E1C\u7701 -home.city=\u5E7F\u5DDE\u5E02 -home.desc=dev: \u7C4D\u8D2F\u6240\u5728\u5730\u4E3A${home.province} ${home.city}. -user.age=82 -user.desc=\u674E\u56DB diff --git a/study-springboot-chapter01/src/main/resources/application.properties b/study-springboot-chapter01/src/main/resources/application.properties deleted file mode 100644 index 2130c79..0000000 --- a/study-springboot-chapter01/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -#\u6307\u5B9A\u9ED8\u8BA4\u7684\u73AF\u5883\u914D\u7F6E -spring.profiles.active=dev \ No newline at end of file diff --git a/study-springboot-chapter01/src/main/resources/application.yml b/study-springboot-chapter01/src/main/resources/application.yml deleted file mode 100644 index 95db8d4..0000000 --- a/study-springboot-chapter01/src/main/resources/application.yml +++ /dev/null @@ -1,32 +0,0 @@ -#服务配置:key=value -server: - port: 81 -# #设置日志相关打印sql 语句 -logging: - level: - com.cbitedu: debug - org.springframework.web: debug -#关闭运行日志图标(banner) -spring: - datasource: - url: jdbc:mysql://localhost:3306/shopping?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC - username: root - password: 123456 - driver-class-name: com.mysql.cj.jdbc.Driver - #Thymeleaf模板引擎相关配置 - thymeleaf: - #prefix:指定模板所在的目录 - prefix: classpath:/templates/ - #check-tempate-location: 检查模板路径是否存在 - check-template-location: true - #cache: 是否缓存,开发模式下设置为false,避免改了模板还要重启服务器,线上设置为true,可以提高性能。 - cache: false - #suffix 配置模板后缀名 - suffix: .html - encoding: UTF-8 - mode: HTML5 - devtools: - restart: - enabled: true #设置开启热部署 - additional-paths: src/main/java #重启目录 - # exclude: static/**,public/**,db/**,i18n/**,templates/** #排除文件(不重启项目) \ No newline at end of file diff --git a/study-springboot-chapter01/src/main/resources/config/customconfig.properties b/study-springboot-chapter01/src/main/resources/config/customconfig.properties deleted file mode 100644 index 394f580..0000000 --- a/study-springboot-chapter01/src/main/resources/config/customconfig.properties +++ /dev/null @@ -1,5 +0,0 @@ -#\u81EA\u5B9A\u4E49\u5C5E\u6027 -config.picpath=d:/upload/pic -config.videopath=d:/upload/video -#\u57DF\u540D\u670D\u52A1 -config.serverdomain=http://www.budaos.com diff --git a/study-springboot-chapter01/src/main/resources/logback-spring.xml b/study-springboot-chapter01/src/main/resources/logback-spring.xml deleted file mode 100644 index fb5715a..0000000 --- a/study-springboot-chapter01/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - %d{yyyy-MM-dd HH:mm:ss} [%level] - %m%n - - - DEBUG - ACCEPT - ACCEPT - - - - - log/mybatisplus_info.log - - %d{yyyy-MM-dd HH:mm:ss} [%class:%line] - %m%n - - - INFO - ACCEPT - DENY - - - log/mybatisplus_info.%d{yyyy-MM-dd}.log - 30 - - - - - log/mybatisplus_error.log - - %d{yyyy-MM-dd HH:mm:ss} [%class:%line] - %m%n - - - ERROR - ACCEPT - DENY - - - log/mybatisplus_error.%d{yyyy-MM-dd}.log - 30 - - - - - - - - - \ No newline at end of file diff --git a/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/CustomConfigTest.java b/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/CustomConfigTest.java deleted file mode 100644 index 3c89549..0000000 --- a/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/CustomConfigTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.cbitedu.springboot.property; - -import com.cbitedu.springboot.config.CustomProperties; -import com.cbitedu.springboot.config.CustomValue; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -//@EnableConfigurationProperties(CustomProperties.class) -public class CustomConfigTest { - private static final Logger LOGGER = LoggerFactory.getLogger(CustomConfigTest.class); - @Autowired - CustomProperties customProperties; - @Autowired - CustomValue customValue; - @Test - public void testConfig(){ - LOGGER.info("图片上传的路径为"+customValue.getPicPath()); - LOGGER.info("参数列表"+customValue.toString()); - } - - @Test - public void testConfig1(){ - LOGGER.info("图片上传的路径为"+customProperties.getPicPath()); - LOGGER.info("参数列表"+customProperties.toString()); - } -} diff --git a/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/HomeProperties1.java b/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/HomeProperties1.java deleted file mode 100644 index 6391b0d..0000000 --- a/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/HomeProperties1.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.cbitedu.springboot.property; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -/** - * 家乡属性 - * - * Created by bysocket on 17/04/2017. - */ -@Component -public class HomeProperties1 { - - /** - * 省份 - */ - @Value("${home.province}") - private String province; - - /** - * 城市 - */ - @Value("${home.city}") - private String city; - - /** - * 描述 - */ - @Value("${home.desc}") - private String desc; - - public String getProvince() { - return province; - } - - public void setProvince(String province) { - this.province = province; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - @Override - public String toString() { - return "HomeProperties1{" + - "province='" + province + '\'' + - ", city='" + city + '\'' + - ", desc='" + desc + '\'' + - '}'; - } -} diff --git a/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/PropertiesTest.java b/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/PropertiesTest.java deleted file mode 100644 index 28fdd16..0000000 --- a/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/property/PropertiesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.cbitedu.springboot.property; - -import com.cbitedu.springboot.config.HomeProperties; -import com.cbitedu.springboot.config.UserProperties; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -/** - * 读取配置文件测试类 - *

- * Created by cbitedu on 17/04/2021. - */ -@RunWith(SpringRunner.class) -@SpringBootTest -public class PropertiesTest { - - private static final Logger LOGGER = LoggerFactory.getLogger(PropertiesTest.class); - - @Autowired - private UserProperties userProperties; - - @Autowired - private HomeProperties homeProperties; - - @Test - public void getHomeProperties() { - LOGGER.info("\n\n" + homeProperties.toString() + "\n"); - } - - @Test - public void randomTestUser() { - LOGGER.info("\n\n" + userProperties.toString() + "\n"); - } - -} diff --git a/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/web/HelloWorldControllerTest.java b/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/web/HelloWorldControllerTest.java deleted file mode 100644 index cdb596f..0000000 --- a/study-springboot-chapter01/src/test/java/com/cbitedu/springboot/web/HelloWorldControllerTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.cbitedu.springboot.web; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * Spring Boot HelloWorldController 测试 - {@link HelloWorldController} - * - * Created by cbitedu on 17/04/2021. - */ -public class HelloWorldControllerTest { - - @Test - public void testSayHello() { - assertEquals("Hello,World!",new HelloWorldController().sayHello()); - } -} diff --git a/study-springboot-chapter01/src/test/resouorces/application.yml b/study-springboot-chapter01/src/test/resouorces/application.yml deleted file mode 100644 index b52d7b1..0000000 --- a/study-springboot-chapter01/src/test/resouorces/application.yml +++ /dev/null @@ -1,23 +0,0 @@ -#服务配置 -server: - port: 81 - -#关闭运行日志图标(banner) -spring: - main: - banner-mode:off - #设置日志相关 - logging.level.root=error - -## 家乡属性 -home: - province: 浙江省 - city: 温岭松门 - desc: 我家住在${home.province}的${home.city} - -## 随机属性 -user: - id: ${random.long} - age: ${random.int[1,200]} - desc: 程序员叫做${random.value} - uuid: ${random.uuid} \ No newline at end of file diff --git a/study-springboot-chapter01/src/test/resources/application.yml b/study-springboot-chapter01/src/test/resources/application.yml deleted file mode 100644 index 4c2c892..0000000 --- a/study-springboot-chapter01/src/test/resources/application.yml +++ /dev/null @@ -1,17 +0,0 @@ -#服务配置 -server: - port: 81 -# #设置日志相关打印sql 语句 -logging: - level: - top.lrshuai.plus.springbootmybatisplus.test.mapper.ShipmentMapper: debug -#关闭运行日志图标(banner) -spring: - datasource: - url: jdbc:mysql://localhost:3306/shopping?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC - username: root - password: 123456 - driver-class-name: com.mysql.cj.jdbc.Driver -#mybatis-plus配置 -mybatis-plus: - mapper-locations: classpath*:mapper/*.xml \ No newline at end of file -- Gitee