Skip to content

Instantly share code, notes, and snippets.

Created May 25, 2020 18:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
URI Template test in Java
package com.example.demo;
import java.util.Map;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.UriTemplate;
public class DemoApplication {
public static void main(String[] args) {, args);
public String uriTemplate() {
UriTemplate ut = new UriTemplate("{ip}");
Map<String, String> m = ut.match("");
return String.format("ip := %s", m.get("ip"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment