javaEE-day04-Web入门-SpringBootWeb-快速入门

This commit is contained in:
2026-09-12 16:28:25 +08:00
parent 18f9390f7e
commit 4f0c76b7e7
6 changed files with 110 additions and 0 deletions
@@ -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);
}
}
@@ -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";
}
}
@@ -0,0 +1,2 @@
spring.application.name=springboot-web-quickstart
server.port=8080
@@ -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() {
}
}