java - Share RestTemplate's MessageConverters across multiple instances -


benchmarks made showed 70% of time creating new resttamplate() messageconverters, wondered if it's safe create 1 set of converters , use across multiple instances, different threads.

edit: motivation logging "on wire" traffic. thought implementing using clienthttprequestinterceptor. since each request should logged different file, thought create new resttemplate each set of requests, different interceptor.

this javadoc of httpmessageconverter doesn't explicitly require it, intention implementations thread safe. if thread safe, safe use across multiple resttemplate instances.


resttemplate other http client use. shouldn't typically need more 1 instance per application. (some exceptions exist proxies, ssl configurations, etc.)


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -