springboot学习笔记,第一章
开发工具:IntelliJ IDEA 2021.3.1
JDK:1.8.0_191
maven:3.6.1
一、创建一个空的maven项目
二、maven配置
setting.xml添加阿里云镜像
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
三、添加springboot父工程
在pom.xml文件中添加如下代码
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>2.5.14</version>
</parent>
四、创建启动类
名称定义未XXXXApplication
pom.xml文件中添加
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>2.5.14</version>
</dependency>
</dependencies>
添加main方法和SpringBootApplication注解
package com.zeven;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.SpringApplication;
/**
* @author zeven
* @since 2023/4/4
* @description:项目启动类
**/
@SpringBootApplication
public class LoginApplication {
public static void main(String[] args) {
System.out.println(" 项目启动开始 (¥&‿&) ");
SpringApplication.run(LoginApplication.class,args);
System.out.println(" 项目启动成功 (♥◠‿◠) ");
}
}
五、添加springboot的yaml文件
在resources目录下创建文件application.yaml
server:
#应用端口号
port: 18081
# 应用的访问路径
servlet:
context-path: /zeven
六、启动项目
启动方式一(推荐):
启动方式二:
项目启动成功。
七、修改启动图案banner
访问在线生成地址:http://patorjk.com/software/taag/
将预览图显示内容全选,然后在resoures下新建文件banner.txt,然后把复制的图案黏贴过去。
再次启动项目就会发现,启动时的图案变成你自己定义的了。