From 761885626c4f1e491548f77ebe448ecf6355091b Mon Sep 17 00:00:00 2001 From: jshixiong Date: Wed, 1 Feb 2023 11:02:24 +0800 Subject: [PATCH] commit 1 --- .gitignore | 5 ++ pom.xml | 58 ++++++++++++++++++ .../jsxtestttt/JsxtesttttApplication.java | 13 ++++ .../controller/HelloController.java | 24 ++++++++ src/main/resources/application.properties | 2 + src/main/resources/logback-spring.xml | 59 +++++++++++++++++++ .../JsxtesttttApplicationTests.java | 13 ++++ 7 files changed, 174 insertions(+) create mode 100644 pom.xml create mode 100644 src/main/java/com/example/test/jsxtestttt/JsxtesttttApplication.java create mode 100644 src/main/java/com/example/test/jsxtestttt/controller/HelloController.java create mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/logback-spring.xml create mode 100644 src/test/java/com/example/test/jsxtestttt/JsxtesttttApplicationTests.java diff --git a/.gitignore b/.gitignore index 84adb3f..2e26942 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,12 @@ *.zip *.tar.gz *.rar +*.iml # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* +.idea +.vscode +target/ + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..9cd96c8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + + + com.example + jsxtestttt + 0.0.1-SNAPSHOT + jsxtestttt + Demo project for Spring Boot + + 1.8 + + + + org.springframework.boot + spring-boot-starter + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-starter-web + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/src/main/java/com/example/test/jsxtestttt/JsxtesttttApplication.java b/src/main/java/com/example/test/jsxtestttt/JsxtesttttApplication.java new file mode 100644 index 0000000..874dfcd --- /dev/null +++ b/src/main/java/com/example/test/jsxtestttt/JsxtesttttApplication.java @@ -0,0 +1,13 @@ +package com.example.test.jsxtestttt; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class JsxtesttttApplication { + + public static void main(String[] args) { + SpringApplication.run(JsxtesttttApplication.class, args); + } + +} diff --git a/src/main/java/com/example/test/jsxtestttt/controller/HelloController.java b/src/main/java/com/example/test/jsxtestttt/controller/HelloController.java new file mode 100644 index 0000000..0bd6ad8 --- /dev/null +++ b/src/main/java/com/example/test/jsxtestttt/controller/HelloController.java @@ -0,0 +1,24 @@ +package com.example.test.jsxtestttt.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HelloController { + + private final Logger logger = LoggerFactory.getLogger(HelloController.class); + + @GetMapping("/") + public String index() { + logger.info("a log : web greetings from Spring Boot"); + return "Greetings from Spring Boot!"; + } + @GetMapping("/healthcheck") + public String healthcheck() { + return "Greetings from Spring Boot!"; + } + +} + diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..8871991 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,2 @@ +server.port=8881 +logging.config=classpath:logback-spring.xml diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..b54eaae --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,59 @@ + + + + + + + + + ${logPattern} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/com/example/test/jsxtestttt/JsxtesttttApplicationTests.java b/src/test/java/com/example/test/jsxtestttt/JsxtesttttApplicationTests.java new file mode 100644 index 0000000..b1af738 --- /dev/null +++ b/src/test/java/com/example/test/jsxtestttt/JsxtesttttApplicationTests.java @@ -0,0 +1,13 @@ +package com.example.test.jsxtestttt; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class JsxtesttttApplicationTests { + + @Test + void contextLoads() { + } + +}