In the spring IOC container, you can set <beans default-lazy-init= "XXX" ></beans> to be lazy-loading mode, Lazy loading means that the bean is loaded into the container when the spring container is loaded. In the absence of settings, the default is false, which means that lazy loading mode is not used.
When set to False (or not set) when Tomcat starts, it appears:
Initializing Spring root Webapplicationcontextlog4j:warn No appenders could be found for logger (org.springframework.web. Context. Contextloader). Log4j:warn Initialize the log4j system Properly.log4j:WARN see http://logging.apache.org/log4j/ 1.2/faq.html#noconfig for more info. Test Spring's Lazy property 2015-10-13 19:06:04 Org.apache.coyote.http11.Http11Protocol Start info: Starting Coyote http/1.1 on http-80802015-10-13 19:06:04 org.apache.jk.common.ChannelSocket init info: jk:ajp13 li Stening on/0.0.0.0:80092015-10-13 19:06:04 org.apache.jk.server.JkMain start info: JK Running id=0 time=0/17 config= NULL2015-10-13 19:06:04 Org.apache.catalina.startup.Catalina Start information: Server Startup in 3546 MS
When set to True, start Tomcat:
Initializing Spring root Webapplicationcontextlog4j:warn No appenders could be found for logger (org.springframework.web. Context. Contextloader). Log4j:warn Initialize the log4j system Properly.log4j:WARN see http://logging.apache.org/log4j/ 1.2/faq.html#noconfig for more info.2015-10-13 19:15:44 Org.apache.coyote.http11.Http11Protocol start info: Starting Coyote http/1.1 on http-80802015-10-13 19:15:44 org.apache.jk.common.ChannelSocket init information: jk:ajp13 listening on/0.0.0. 0:80092015-10-13 19:15:44 org.apache.jk.server.JkMain Start info: JK Running id=0 time=0/51 config=null2015-10-13 19:15:44 Org.apache.catalina.startup.Catalina Start Information: Server Startup in 3912 MS
This is a test bean.
Package com.yonyou.sys.utils;
The test bean sets the bean's configuration file in the Spring container public class Testbeanlazy {public Testbeanlazy () {System.out.println ("Test Spring's lazy properties" );}}
Lazy Loading of Spring