创立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>    <groupId>com.jt</groupId>    <artifactId>springboot_demo2</artifactId>    <version>1.0-SNAPSHOT</version>    <!--1.对立定义父级我的项目-->    <parent>        <groupId>org.springframework.boot</groupId>        <artifactId>spring-boot-starter-parent</artifactId>        <version>2.3.4.RELEASE</version>        <relativePath/> <!-- lookup parent from repository -->    </parent>    <properties>        <java.version>1.8</java.version>        <!--跳过测试类加载-->        <skipTests>true</skipTests>    </properties>    <!--2.引入第三方依赖-->    <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>            <exclusions>                <exclusion>                    <groupId>org.junit.vintage</groupId>                    <artifactId>junit-vintage-engine</artifactId>                </exclusion>            </exclusions>        </dependency>    </dependencies>    <!--3.增加插件-->    <build>        <plugins>            <plugin>                <groupId>org.springframework.boot</groupId>                <artifactId>spring-boot-maven-plugin</artifactId>            </plugin>        </plugins>    </build></project>

编辑主启动类

@SpringBootApplication  //标识我是一个SpringBoot的我的项目public class SpringBootRun {    public static void main(String[] args) {        SpringApplication.run(SpringBootRun.class,args);    }}

编辑测试Controller

package com.jt.controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class HelloController {    /**     * 用户通过/hello的门路获取 敌对的提示信息.     */    @RequestMapping("/hello")    public String hello(){        return "搭建环境真艰难,为什么就我的不行呢? 我昨天干了什么呢!!!!!";    }}