自学SpringBoot学习笔记--快速搭建项目

大神请飘过,由于自己健忘厉害,所以将学习过程记录下来~

idea快速创建springboot测试项目:

File-->new project-->SpringInitializr

自学SpringBoot学习笔记--快速搭建项目_第1张图片

Next

自学SpringBoot学习笔记--快速搭建项目_第2张图片

为项目起好组名,项目名。Next,因为我要创建web项目,故做以下配置。(避免我们还要去pom中去配置)

自学SpringBoot学习笔记--快速搭建项目_第3张图片

这里选中一个web就可以了 下面的sql啥的如果需要也是可以选的,但是一旦选择了需要配置数据源,否则启动项目会报错。在这里我选择以后再配置,这里就是快速搭建项目。

自学SpringBoot学习笔记--快速搭建项目_第4张图片

项目名字

Finish,项目结构

自学SpringBoot学习笔记--快速搭建项目_第5张图片

找到项目的的入口类,PaomoApplication

自学SpringBoot学习笔记--快速搭建项目_第6张图片

此注解代表了项目入口。为了便于测试,我要加一个Controller

自学SpringBoot学习笔记--快速搭建项目_第7张图片

现在启动项目。

自学SpringBoot学习笔记--快速搭建项目_第8张图片

只需要启动PaomoApplication就可以。

自学SpringBoot学习笔记--快速搭建项目_第9张图片

默认8080端口,浏览器访问一下。

自学SpringBoot学习笔记--快速搭建项目_第10张图片

ojbk,完成。

注:

如果端口被占用了,想修改端口。

在application.properties中修改一下:

自学SpringBoot学习笔记--快速搭建项目_第11张图片

POM文件说明:

xml version="1.0" encoding="UTF-8"?>
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">
   4.0.0

   com.learn
   paomo
   0.0.1-SNAPSHOT
   jar

   paomo
   Demo project for Spring Boot

   
   
      org.springframework.boot
      spring-boot-starter-parent
      2.0.2.RELEASE
       
   

   
      UTF-8
      UTF-8
      1.8
   

   
   
      
         org.springframework.boot
         spring-boot-starter-web
      
   
      
         org.springframework.boot
         spring-boot-starter-test
         test
      
   
   
   
      
         
            org.springframework.boot
            spring-boot-maven-plugin
         
      
   


你可能感兴趣的:(springboot,springboot)