第一个springboot项目

This commit is contained in:
2025-09-15 16:27:56 +08:00
parent e2d25a80de
commit a5c94122fb
6 changed files with 127 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
package com.inmind;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication//表示默认启动项
public class SpringbootWebQuickstartApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootWebQuickstartApplication.class, args);
}
}

View File

@@ -0,0 +1,17 @@
package com.inmind.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//当前类是请求处理类
@RestController
public class HelloController {
//接收到请求资源路径为/hello,就由该方法处理请求
@RequestMapping("/hello")
public String hello(){
String s = "hello world";
System.out.println(s);
return s;
}
}

View File

@@ -0,0 +1,3 @@
# 应用服务 WEB 访问端口
server.port=8080

View File

@@ -0,0 +1,6 @@
<html>
<body>
<h1>hello word!!!</h1>
<p>this is a html page</p>
</body>
</html>

View File

@@ -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() {
}
}