package demo.helloprovider;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloProviderController {
    /*
    @GetMapping(value = "/greet/{username}")
    public String greet(@PathVariable String username) {
        return "Hello," + username;
    }
    */

    @Value("${server.port}")
    private String servicePort;

    @Value("${spring.application.name}")
    private String serviceName;

    @GetMapping(value = "/greet/{username}")
    public String greet(@PathVariable String username) {
        return "Hello," + username
               +"<br>Service Name:" + serviceName+"<br>Service Port:"+servicePort;
    }

}


/*********************************************************
 * 作者：孙卫琴                                   
 * 来源：《Spring Cloud Alibaba微服务开发零基础入门到实战》源代码  
 * 技术支持网址：www.javathinker.net/alibaba                    
 *********************************************************/
