- 新建intellij project maven 項目
- 加入pom依賴
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Created by csophys on 16/8/31.
*/
@Controller
@EnableAutoConfiguration
public class ExecutorController {
@RequestMapping("/")
@ResponseBody
public String hello(){
return "hello world";
}
public static void main(String[] args) {
SpringApplication.run(ExecutorController.class,args);
}
}
resources下新建static 目錄,static目錄下新建index.html 文件能夠默認訪問到
1. 修改xml
加入
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
2. 執行jar
java -jar /Users/csophys/code/downloadVoiceFileWithConnid/target/csophys-1.0-SNAPSHOT.jar