我正在尝试将以下对象转换为查询字符串,以便与GET请求一起使用。
我们可以先将对象转换为Map,然后将Map转换为MultiValueMap,并使用URIComponentsBuilder.fromHttpUrl("httpL//example.com").queryParams(multiValueMap).build()。有没有更短、更好的方法将对象转换为查询字符串,以便在Spring项目中用于Junit测试中的GET请求?
Class A {
String prop1;
String prop2;
Date date1;
Date date2;
ClassB objB;
}
Class B {
String prop3;
String prop4;
}
我们可以先将对象转换为Map,然后将Map转换为MultiValueMap,并使用URIComponentsBuilder.fromHttpUrl("httpL//example.com").queryParams(multiValueMap).build()。有没有更短、更好的方法将对象转换为查询字符串,以便在Spring项目中用于Junit测试中的GET请求?