Spring Boot 2.0 動畫Banner

鄭龍飛發表於2018-03-02

Spring Boot是由Pivotal團隊提供的全新框架,其設計目的是用來簡化新Spring應用的初始搭建以及開發過程。v2.0.0.RELEASE已於昨天正式釋出。

前言

本篇文章介紹Spring Boot 2.0一個有趣的功能動畫Banner;(當然,在實際開發中沒有用處,just for fun)

準備

  • JDK 1.8 或更高版本
  • Maven 3 或更高版本

技術棧

  • Spring Boot 2.0

目錄結構

https://user-gold-cdn.xitu.io/2018/3/2/161e4532436d2443?w=692&h=573&f=png&s=50277
https://user-gold-cdn.xitu.io/2018/3/2/161e4532436d2443?w=692&h=573&f=png&s=50277

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>cn.merryyou</groupId>
	<artifactId>animated-banner</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>animated-banner</name>
	<description>A very useful project to demonstrate animated gif support in Spring Boot 2</description>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.0.0.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</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>
				<configuration>
					<includeSystemScope>true</includeSystemScope>
				</configuration>
			</plugin>
		</plugins>
	</build>


</project>

複製程式碼

專案打包

https://user-gold-cdn.xitu.io/2018/3/2/161e4532437aac40?w=581&h=646&f=png&s=56261
https://user-gold-cdn.xitu.io/2018/3/2/161e4532437aac40?w=581&h=646&f=png&s=56261

控制檯啟動專案(MAC)

java -jar animated-banner-0.0.1-SNAPSHOT.jar

效果如下:

https://user-gold-cdn.xitu.io/2018/3/2/161e453243554563?w=640&h=432&f=gif&s=2908499
https://user-gold-cdn.xitu.io/2018/3/2/161e453243554563?w=640&h=432&f=gif&s=2908499

程式碼下載

從我的 github 中下載,github.com/longfeizhen…


https://user-gold-cdn.xitu.io/2018/2/28/161dbadd0162fdb1?w=301&h=330&f=png&s=78572
https://user-gold-cdn.xitu.io/2018/2/28/161dbadd0162fdb1?w=301&h=330&f=png&s=78572

???關注微信小程式java架構師歷程 上下班的路上無聊嗎?還在看小說、新聞嗎?不知道怎樣提高自己的技術嗎?來吧這裡有你需要的java架構文章,1.5w+的java工程師都在看,你還在等什麼?

相關文章