Spring Bean life cycle: http://www.cnblogs.com/zrtqsk/p/3735273.html
Session Bean Creation:
/** * created by dongsilin on 2017/3/7. * resttemplate bean, Life cycle for session */@Configurationpublic class RestTemplateBean { private static final simpleclienthttprequestfactory requestfactory = new Simpleclienthttprequestfactory (); private static final Httpmessageconverter httpmessageconverter = new stringhttpmessageconverter (Charset.forName ("UTF-8")); static { Requestfactory.setreadtimeout (1000 * 30); //30s requestfactory.setconnecttimeout (1000 * 30); //30s } @Bean @Scope (value = "Session", proxymode = scopedproxymode.target_class)    &NBSp;public resttemplate initresttemplate () { Resttemplate resttemplate = new resttemplate (); resttemplate.setrequestfactory (requestfactory); Resttemplate.getmessageconverters (). Set (1, httpmessageconverter); return resttemplate; }}
Session Bean Uses:
@Autowiredprivate resttemplate resttemplate;
This article is from the "DSLZC" blog, make sure to keep this source http://dslzc921029.blog.51cto.com/10187165/1903832
Spring-based Bean creation in session mode