javaEEday04-springboot-快速入门

This commit is contained in:
2026-05-06 14:29:02 +08:00
parent b56fc7fdac
commit cd52a49a39
5 changed files with 105 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--使用的springboot的父工程-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.14</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<!--当前项目的maven坐标-->
<groupId>com.inmind</groupId>
<artifactId>springboot-web-quickstart</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springboot-web-quickstart</name>
<description>springboot-web-quickstart</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<!--pom文件中的统一版本配置信息-->
<properties>
<java.version>17</java.version>
</properties>
<!--依赖包版本信息-->
<dependencies>
<!--spring-web开发启动项-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--spring-测试依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!--maven构建信息-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -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);
}
}

View File

@@ -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工程";
}
}

View File

@@ -0,0 +1 @@
spring.application.name=springboot-web-quickstart

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