diff --git a/springboot-web-quickstart/.gitattributes b/springboot-web-quickstart/.gitattributes new file mode 100644 index 0000000..3b41682 --- /dev/null +++ b/springboot-web-quickstart/.gitattributes @@ -0,0 +1,2 @@ +/mvnw text eol=lf +*.cmd text eol=crlf diff --git a/springboot-web-quickstart/pom.xml b/springboot-web-quickstart/pom.xml new file mode 100644 index 0000000..38e436e --- /dev/null +++ b/springboot-web-quickstart/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 4.1.1 + + + + com.inmind + springboot-web-quickstart + 0.0.1-SNAPSHOT + + + springboot-web-quickstart + springboot-web-quickstart + + + + + + + + + + + + + + + + 17 + + + + + + + org.springframework.boot + spring-boot-starter-webmvc + + + + org.springframework.boot + spring-boot-starter-webmvc-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..2a2e817 --- /dev/null +++ b/springboot-web-quickstart/src/main/java/com/inmind/SpringbootWebQuickstartApplication.java @@ -0,0 +1,15 @@ +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) { + //springboot启动的固定代码 + 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..0e51704 --- /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("接收了一个请求"); + return "hello 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..3bd6f91 --- /dev/null +++ b/springboot-web-quickstart/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.application.name=springboot-web-quickstart +server.port=8080 \ 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() { + } + +}