点击idea 新建项目
此步骤需要什么选什么就行了
此次直接搭建了最简单的
finish等待下载依赖 时间长短取决于网速快慢
项目完整结构
创建controller -》hello.class
编辑配置文件 ;
hello.class
此处我为修改配置文件名,使用的默认配置文件,如不固定端口则:127.0.0.1:port 端口号将每次启动都自动分配字段,不固定
127.0.0.1=localhost
maven 依赖配置 pom.xml
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.5.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.Sboot</groupId> <artifactId>first</artifactId> <version>0.0.1-SNAPSHOT</version> <name>first</name> <description>Demo project for Spring Boot</description> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
至此极简Spring Boot 搭建完成;
直接运行无报错提示:
可打开编辑路径
http://127.0.0.1:8080/test/hello
查看项目编辑的返回值
--至此完成