java - How to merge two ResponseEntity objects in Spring -


i using spring 4.2. i've make 2 separate http calls return responseentity<string>. however, have merge them before returning caller methods.

their data structure similar. content different. how can merge 2 entities before returning caller ?

use rest template entities inside entity want merge.

final string uri = "http://localhost:8080/springrestexample/employees.xml"; resttemplate resttemplate = new resttemplate(); string result = resttemplate.getforobject(uri, string.class);      final string uri2 = "http://localhost:8080/springrestexample/employees2.xml";     resttemplate resttemplate2 = new resttemplate();     string result2 = resttemplate.getforobject(uri, string.class);  return result1+result2; //or mergemethod(result1,result2) 

you can create new endpoint service merging entities collections framework or java 8 stream map.

you can create better repository data access object joining tables on db level - sql, hql, jpql.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -