以前用IDEA 建立Springboot 項目感受十分簡單,可是經常使用的畢竟是Eclipse 因此開一個帖子記錄一下Eclipse 如何建立 Springboot 項目java
第一步:Help -> Eclipse Marketplace…web
在search 中輸入 'STS' spring
install 便可!springboot
第二部:new -> project -> other -> Spring start project;app
點擊finsh SpringBoot 項目建立完成 ,下面寫一個測試demo測試
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); System.out.println( " ---------------------------------------- "); System.out.println( " ---------------------------------------- "); System.out.println( " ---------------------------------------- "); System.out.println("SPRINGBOOT SUCCESS!!"); System.out.println( " ---------------------------------------- "); System.out.println( " ---------------------------------------- "); System.out.println( " ---------------------------------------- "); } }
建立一個helloController.javathis
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;spa
@RestController
public class helloController {3d
@RequestMapping("/hello")
public String test(){
return "hello,this is a springboot demo";
}
}code
運行run