Create a Spring Boot Micro Services

Creating micro-services project HelloWorld a test of

Create a project

Alt text
Alt text
Alt text
Alt text

Writing the Service Code

@RestController
public class HelloWorld {

    @RequestMapping("/hello")
    public String Hello(@RequestParam String name){
        return "你好!" + name + ",这是一个微服务。";
    }
}

Edit the configuration file application.properties:

spring.application.name=spring-cloud-provider-01
server.port=9000

Alt text

Test Run

Alt text

Source

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

Guess you like

Origin www.cnblogs.com/bluersw/p/11610693.html