SpringBoot创建的五种方式
1.通过Springboot官网链接下载

注意SpringBoot项目的封装方式默认为Jar




需要查看一下,自己的Maven版本是否正确

创建成功

2.通过 aliyun官网链接下载
修改服务路径为阿里云链接



创建成功

3.通过Springboot官网下载

点击,拉到最下方


基础配置,如果想要添加依赖


最后,点击GENERATE生成项目包
import 对应的pom.xml

一直点击next,直到finish打开文件

更改配置信息,完成SpringBoot项目创建
4.通过aliyun官网下载
访问官网



注意必须为单模块


5.将mavenJava改成springboot

<?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>
    <!--添加父工程目录 为了更好的将子目录交给SpringBoot管理-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.6</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.qcby</groupId>
    <artifactId>springboot122105</artifactId>
    <version>1.0-SNAPSHOT</version>
    <!--添加内容-->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!--加载web-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>
</project>

加入启动类
package com.qcby.springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//扫描所有dao接口
//@MapperScan("com.qcby.springBootDemo1031.dao")
@SpringBootApplication
public class SpringBootDemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(SpringBootApplication.class, args);
    }
}

我们可以使用自己搭建的SpringBoot进行简单的页面输出
在springboot下面创建controller包,并创建一个表现层的方法

package com.qcby.springboot.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Controller
@RequestMapping("/index")
public class IndexController {
    @RequestMapping("/run")
    public void run(HttpServletResponse response) throws IOException {
        System.out.println("121212");
        response.getWriter().write("hello");
    }
}直接运行启动类的内容

使用嵌入式的 Servlet 容器 Tomcat,应用无需打成 war 包,内嵌Tomcat
前端页面的显示结果



















