创建Spring Boot微服务项目


创建一个测试用的微服务项目HelloWorld

创建项目

Alt text
Alt text
Alt text
Alt text

编写服务代码

@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

Alt text

测试运行

Alt text

源码

Github仓库:https://github.com/sunweisheng/spring-cloud-example


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM