【springboot】IDEA手动创建SpringBoot简单工程(无插件)
大致步骤
创建Maven工程
引入依赖
提供启动类
详细教程
创建Maven工程

修改pom.xml文件
添加父节点
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.5.3</version></parent>

添加springboot依赖
<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency></dependencies>

添加镜像
<!-- 配置阿里云仓库 --><repositories><repository><id>aliyun-repos</id><url>https://maven.aliyun.com/repository/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>aliyun-repos</id><url>https://maven.aliyun.com/repository/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></pluginRepository></pluginRepositories>

刷新

修改启动类


@SpringBootApplication
public class SpringBootCreateManualApplication
{public static void main( String[] args ){SpringApplication.run(SpringBootCreateManualApplication.class,args);}
}

添加资源文件


添加配置文件

application.properties

添加简单示例

package com.zwh.Controller;import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
public class HelloController {@RequestMapping("/hello")public String Hello(){return "Hello World~~~~~~~";}
}
使用的java24需要消除警告


--enable-native-access=ALL-UNNAMED--add-opens java.base/java.lang=ALL-UNNAMED

运行

查看端口

查看结果
http://127.0.0.1:8080/hello

