03【掌握】入门程序
环境要求
①JDK1.8
②maven3.x
③spring tools suite3.9
④springboot2.x版本
⑤spring5
创建项目
方式1



再生成

在直接导入到idea 当中即可 导入还不会的话 就别学了!!!!!
方式2



选中需要的依赖包

项目目录说明

Resource/static/ 存放web的静态资源文件 如图片 css js 等等
Resources/templates 存放模板引擎的文件类比于WEB项目的WEB-INF
Application.properties boot的核心配置文件
Test/java/APPlicationTests.java 测试文件
项目依赖说明
<?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 https://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.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<!-- 当前项目的GAV坐标 -->
<groupId>com.sxt</groupId>
<artifactId>01_springboot_hello</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>01_springboot_hello</name>
<description>我的第一个<u>springboot</u>程序</description>
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
<dependencies>
<!-- 加入<u>springboot</u>对spring web的支持 -->
<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><u>junit</u>-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<!-- 打包插件 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-<u>maven</u>-<u>plugin</u></artifactId>
</plugin>
</plugins>
</build>
</project>
|
创建 UserController

启动

jar包启动测试
右键项目run


查看target

把jar包放到D盘,使用java -jar yangbuyi-erp-2020-0.0.1-SNAPSHOT.jar 来执行

banner的修改
spring Boot启动的时候会有一个默认的启动图案。如下图

(1).在src/main/resources路径下新建一个banner.txt文件,并输入想要的内容即可。

(2).我这里面用在线生成图案的网站 http://www.network-science.de/ascii/如图

再启动

也可以使用一张图片,取名叫banner.png/jpg放到src/main/resources里面


也可以关闭banner

网友评论