前言
項目中使用了很多現成的框架,都是項目經理、架構師帶來的,從來沒有自己整合過!這次決定自己從零開始整合一次,以學習鞏固。過程中參考很多開源框架的思路,工具類等,若有侵權,請速速聯繫,一定妥善處理
一:創建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>org.itachi</groupId>
<artifactId>frame</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>frame</name>
<description>基於Spring Boot的框架集成</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
</project>
二:配置文件和資源文件夾
新建以下配置文件,內容爲空:
application.yml
application.properties
文件夾:
templates
static
三:創建應用啓動類
Application.java
package org.itachi.frame;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 應用啓動類
*
* @author itachi
* @date 2018-10-05 11:45
*/
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
四:一個自己很喜歡的 banner
banner.txt
-'--`--:^^:::::``
:::::-'--`--::: 東邊日出西邊雨
:::-'--::::::: 道是無晴卻有情 |
:::::-'--`--:``::: | \ _ /
::::::::::::::::::: ,|`-._/| -== (_) ==-
::::::::^^::::::::.' | / ||\ / \
::::::^^::::::::.' | / ||`\ |
:::::::::::::::/ `-. |/._ || \
::::::::::::: | || || \
~~=~_~^~ =~ \~~~~~~~'~~~~'~~~~/~~`` ~=~^~
~^^~~-=~^~ ^ `--------------'~^~=~^~_~^=~^~
============================================
五:項目結構
基本springboot項目就初始化好了,項目結構如下
六:測試
啓動應用,初始化完成