Spring Boot是為了簡化Spring應用的創(chuàng)建目锭、運行、調(diào)試村缸、部署等而出現(xiàn)的祠肥,使用它可以做到專注于Spring應用的開發(fā),而無需過多關注XML的配置梯皿。
簡單來說仇箱,它提供了一堆依賴打包,并已經(jīng)按照使用習慣解決了依賴問題---習慣大于約定东羹。
Spring Boot默認使用tomcat作為服務器剂桥,使用logback提供日志記錄。
本項目使用Gradle來構建Spring Boot
buildscript {
? ? ? ? ?repositories {
? ? ? ? mavenCentral()
? ? ? ? ? ? }
? ? ? ? ?dependencies {
? ? ? ? ? ? ? ?classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.1.RELEASE")
? ? ? ? ? ?}
? ?}
//支持插件
applyplugin:'java'
applyplugin:'idea'
applyplugin:'org.springframework.boot'
applyplugin:'war'
war {
baseName='shihuilaw'
version='1.0.0'
}
repositories {
? ? ? ? ? ?maven { url"https://repo.spring.io/libs-release"}
//maven倉庫地址
? ? ? ? ? maven { url"http://maven.aliyun.com/nexus/content/groups/public/"}
? ? ? ? ?mavenLocal()
? ? ? ? ?mavenCentral()
? ? ? ? ? ?maven { url"http://repo.spring.io/libs-snapshot"}
? ?}
sourceCompatibility =1.8//java版本
targetCompatibility =1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
testCompile('org.springframework.boot:spring-boot-starter-test')
compile fileTree(dir:'libs',include:['*.jar'])//手動引入jar包
}
作者:誰在烽煙彼岸
鏈接:http://www.reibang.com/p/14ddea20b88b
來源:簡書
著作權歸作者所有属提。商業(yè)轉(zhuǎn)載請聯(lián)系作者獲得授權权逗,非商業(yè)轉(zhuǎn)載請注明出處。