1、创建一个springboot项目 勾选web和websocket选项
创建完成后build.gradle文件如下,主要是依赖得添加上(另外说明以下compile('org.springframework.boot:spring-boot-starter-web')可以不必要添加,添加compile('org.springframework.boot:spring-boot-starter-websocket')就默认也引入了)
buildscript {
ext {
springBootVersion = '2.0.4.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.yu.test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}