81,090
社区成员
发帖
与我相关
我的任务
分享
group 'com.halo'
version '1.0-SNAPSHOT'
buildscript {
repositories {
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE")
}
}
allprojects {
repositories {
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
jar {
baseName = 'BootDemo'
version = '0.1.0'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
//repositories {
// mavenCentral()
//}
dependencies {
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework:spring-web")
compile("com.fasterxml.jackson.core:jackson-databind")
testCompile("junit:junit")
}
package app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Created by Halo on 2017/6/11.
*/
@SpringBootApplication
public class Application {
public static void main(String[] args){
SpringApplication.run(Application.class,args);
}
}
package controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by Halo on 2017/6/11.
*/
@RestController
@RequestMapping("/index")
public class IndexController {
@RequestMapping("/")
public String index(){
return "hello World!";
}
}