Is there a dynamic way to display Restful service urls?

Currently I am displaying the endpoint to my services by doing something like the following

    <title>RESTful Services</title>
<p>Get your greeting <a href="localhost:8080/rest/Greeting">here</a></p>

This is coming from a spring boot rest service like the following:

@RequestMapping(method = GET, path = "/Greeting" )
    public Greeting greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
        return new Greeting(counter.incrementAndGet(),
                String.format(template, name));

However once I deploy to a server that url will no longer be valid. Is there a way to display the url of the service regardless of environment?