From cfc01c86f8c275bd43bf372a32895af780c7e3e3 Mon Sep 17 00:00:00 2001 From: wenxin <1731551615@qq.com> Date: Sun, 24 Nov 2024 12:02:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 51 +++++----- pom.xml | 94 +++++++++++++++++++ .../linxyun/homework/HomeworkApplication.java | 15 +++ src/main/resources/application.yml | 35 +++++++ src/main/resources/static/index.html | 6 ++ .../homework/HomeworkApplicationTests.java | 13 +++ 6 files changed, 192 insertions(+), 22 deletions(-) create mode 100644 pom.xml create mode 100644 src/main/java/com/linxyun/homework/HomeworkApplication.java create mode 100644 src/main/resources/application.yml create mode 100644 src/main/resources/static/index.html create mode 100644 src/test/java/com/linxyun/homework/HomeworkApplicationTests.java diff --git a/.gitignore b/.gitignore index 9154f4c..549e00a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,33 @@ -# ---> Java -# Compiled class file -*.class +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ -# Log file -*.log +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache -# BlueJ files -*.ctxt +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -replay_pid* +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ +### VS Code ### +.vscode/ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..8525c28 --- /dev/null +++ b/pom.xml @@ -0,0 +1,94 @@ + + + 4.0.0 + com.linxyun + homework + 0.0.1-SNAPSHOT + homework + homework + + 17 + UTF-8 + UTF-8 + 2.7.6 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + mysql + mysql-connector-java + 8.0.33 + + + + + com.baomidou + mybatis-plus-boot-starter + 3.5.9 + + + com.alibaba + druid-spring-boot-starter + 1.2.22 + + + org.projectlombok + lombok + 1.18.34 + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + 17 + UTF-8 + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + com.linxyun.homework.HomeworkApplication + true + + + + repackage + + repackage + + + + + + + + diff --git a/src/main/java/com/linxyun/homework/HomeworkApplication.java b/src/main/java/com/linxyun/homework/HomeworkApplication.java new file mode 100644 index 0000000..a1df4fc --- /dev/null +++ b/src/main/java/com/linxyun/homework/HomeworkApplication.java @@ -0,0 +1,15 @@ +package com.linxyun.homework; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@MapperScan("com.linxyun.homework.mapper") +public class HomeworkApplication { + + public static void main(String[] args) { + SpringApplication.run(HomeworkApplication.class, args); + } + +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..ac1f6ca --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,35 @@ +# 应用服务 WEB 访问端口 +server: + port: 8080 + +spring: #springboot的配置 + datasource: #定义数据源 + #127.0.0.1为本机测试的ip,3306是mysql的端口号。serverTimezone是定义时区,照抄就好,mysql高版本需要定义这些东西 + #useSSL也是某些高版本mysql需要问有没有用SSL连接 + url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=GMT%2B8&useSSL=FALSE + username: root #数据库用户名,root为管理员 + password: 123456 #该数据库用户的密码 + # 使用druid数据源 + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + +# mybatis-plus相关配置 +mybatis-plus: + # xml扫描,多个目录用逗号或者分号分隔(告诉 Mapper 所对应的 XML 文件位置) + mapper-locations: classpath:mapper/*.xml + # 指定 MyBatis 别名包扫描路径,用于给包中的类注册别名。注册后,在 Mapper 对应的 XML 文件中可以直接使用类名,无需使用全限定类名。 + type-aliases-package: com.linxyun.homework.domain + # 以下配置均有默认值,可以不设置 + global-config: + db-config: + # 表名前缀 + tablePrefix: tab_ + #主键类型 AUTO:"数据库ID自增" INPUT:"用户输入ID",ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: auto + configuration: + # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射 + map-underscore-to-camel-case: true + # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段 + call-setters-on-nulls: true + # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl \ No newline at end of file diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html new file mode 100644 index 0000000..89bb8ba --- /dev/null +++ b/src/main/resources/static/index.html @@ -0,0 +1,6 @@ + + +

hello word!!!

+

this is a html page

+ + \ No newline at end of file diff --git a/src/test/java/com/linxyun/homework/HomeworkApplicationTests.java b/src/test/java/com/linxyun/homework/HomeworkApplicationTests.java new file mode 100644 index 0000000..a099d9a --- /dev/null +++ b/src/test/java/com/linxyun/homework/HomeworkApplicationTests.java @@ -0,0 +1,13 @@ +package com.linxyun.homework; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class HomeworkApplicationTests { + + @Test + void contextLoads() { + } + +}