Spring-boot开发环境搭建
2016-08-16 本文已影响596人
韬韬不绝
下载Eclipse
http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/neonr
安装Java 1.8
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
安装Git、SourceTree(版本管理工具)
自行google
安装Gradle插件
从eclipse插件市场搜索gradle安装。
![](https://img.haomeiwen.com/i78242/ee39ecede2d3eb3d.png)
配置Gradle依赖
build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE") }
}
apply plugin: 'java'
apply plugin: 'spring-boot'
apply plugin: 'eclipse'
jar {
baseName = 'help-center'
version = '0.1.0'
manifest { attributes 'Main-Class': 'cn.com.duiba.help.Application' }
}
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-data-jpa") //jpa框架
compile("org.springframework.boot:spring-boot-starter-velocity") //velocity 模板引擎
compile("org.springframework.boot:spring-boot-starter-test") //单元测试
compile("org.springframework:spring-tx") //Spring事务处理包
compile('mysql:mysql-connector-java:5.1.34') //Mysql官方驱动包
compile('commons-lang:commons-lang:2.6') //commons基础包,针对Java.lang包进行一些封装,提供一些工具类
compile fileTree(dir: 'lib', include: '*.jar')
testCompile("junit:junit")
}
编辑完后右键项目,刷新依赖
![](https://img.haomeiwen.com/i78242/2831309fc5c1fea7.png)
项目结构
项目结构如下
![](https://img.haomeiwen.com/i78242/0fcd17146d6561fd.png)