Spring 获取rest模板的信息
我见过很多代码使用这个Spring 获取rest模板的信息,spring,rest,Spring,Rest,我见过很多代码使用这个getForObject()方法,它接受一个URI并用方法末尾的数字替换{}中的内容 我的问题是:http://localhost:8080/spring-rest/foos?这是某种文件吗?在这种情况下会是什么样子。在您的示例中: Foo foo = restTemplate.getForObject(URI, Foo.class, "1"); 实际上正在尝试通过HTTP请求获取REST资源 在封面下: URL模板呈现为http://localhost:8080/spi
getForObject()
方法,它接受一个URI并用方法末尾的数字替换{}
中的内容
我的问题是:http://localhost:8080/spring-rest/foos
?这是某种文件吗?在这种情况下会是什么样子。在您的示例中:
Foo foo = restTemplate.getForObject(URI, Foo.class, "1");
实际上正在尝试通过HTTP请求获取REST资源
在封面下:
http://localhost:8080/sping-rest/foos/1
http://localhost:8080/sping-rest/foos/1
{“id”:1,“content”:“Hello,World!”}