創建一個測試用的微服務項目HelloWorld
創建項目




編寫服務代碼
@RestController
public class HelloWorld {
@RequestMapping("/hello")
public String Hello(@RequestParam String name){
return "你好!" + name + ",這是一個微服務。";
}
}
編輯配置文件application.properties:
spring.application.name=spring-cloud-provider-01
server.port=9000

測試運行

源碼
Github倉庫:https://github.com/sunweisheng/spring-cloud-example
