From cd52a49a39822678f1c7f65cc27a9d181a51876d Mon Sep 17 00:00:00 2001 From: xuxin <840198532@qq.com> Date: Wed, 6 May 2026 14:29:02 +0800 Subject: [PATCH] =?UTF-8?q?javaEEday04-springboot-=E5=BF=AB=E9=80=9F?= =?UTF-8?q?=E5=85=A5=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- springboot-web-quickstart/pom.xml | 62 +++++++++++++++++++ .../SpringbootWebQuickstartApplication.java | 14 +++++ .../inmind/controller/HelloController.java | 15 +++++ .../src/main/resources/application.properties | 1 + ...ringbootWebQuickstartApplicationTests.java | 13 ++++ 5 files changed, 105 insertions(+) create mode 100644 springboot-web-quickstart/pom.xml create mode 100644 springboot-web-quickstart/src/main/java/com/inmind/SpringbootWebQuickstartApplication.java create mode 100644 springboot-web-quickstart/src/main/java/com/inmind/controller/HelloController.java create mode 100644 springboot-web-quickstart/src/main/resources/application.properties create mode 100644 springboot-web-quickstart/src/test/java/com/inmind/SpringbootWebQuickstartApplicationTests.java diff --git a/springboot-web-quickstart/pom.xml b/springboot-web-quickstart/pom.xml new file mode 100644 index 0000000..bd20022 --- /dev/null +++ b/springboot-web-quickstart/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 3.5.14 + + + + com.inmind + springboot-web-quickstart + 0.0.1-SNAPSHOT + + springboot-web-quickstart + springboot-web-quickstart + + + + + + + + + + + + + + + + 17 + + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/springboot-web-quickstart/src/main/java/com/inmind/SpringbootWebQuickstartApplication.java b/springboot-web-quickstart/src/main/java/com/inmind/SpringbootWebQuickstartApplication.java new file mode 100644 index 0000000..77aaca4 --- /dev/null +++ b/springboot-web-quickstart/src/main/java/com/inmind/SpringbootWebQuickstartApplication.java @@ -0,0 +1,14 @@ +package com.inmind; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/*启动类:启动当前的springboot项目*/ +@SpringBootApplication +public class SpringbootWebQuickstartApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringbootWebQuickstartApplication.class, args); + } + +} diff --git a/springboot-web-quickstart/src/main/java/com/inmind/controller/HelloController.java b/springboot-web-quickstart/src/main/java/com/inmind/controller/HelloController.java new file mode 100644 index 0000000..5f0a980 --- /dev/null +++ b/springboot-web-quickstart/src/main/java/com/inmind/controller/HelloController.java @@ -0,0 +1,15 @@ +package com.inmind.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +//请求处理类 +@RestController +public class HelloController { + + @RequestMapping(value = "/hello") + public String hello(){ + System.out.println("hello world"); + return "hello world,这是一个springboot工程"; + } +} diff --git a/springboot-web-quickstart/src/main/resources/application.properties b/springboot-web-quickstart/src/main/resources/application.properties new file mode 100644 index 0000000..aa595e2 --- /dev/null +++ b/springboot-web-quickstart/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.application.name=springboot-web-quickstart \ No newline at end of file diff --git a/springboot-web-quickstart/src/test/java/com/inmind/SpringbootWebQuickstartApplicationTests.java b/springboot-web-quickstart/src/test/java/com/inmind/SpringbootWebQuickstartApplicationTests.java new file mode 100644 index 0000000..265a020 --- /dev/null +++ b/springboot-web-quickstart/src/test/java/com/inmind/SpringbootWebQuickstartApplicationTests.java @@ -0,0 +1,13 @@ +package com.inmind; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class SpringbootWebQuickstartApplicationTests { + + @Test + void contextLoads() { + } + +}