IOC refers to the inversion of control, the creation of objects, initialization, destruction and other work to the spring container. The spring container controls the life cycle of the object.
Spring Object Initialization Bean timing:
By default, as long as a bean is configured in the Spring container, the container will instantiate the bean at startup, in Singleton mode.
If you set lazy-load mode (lazy-init= "true") in spring when you are preparing a file, the object is instantiated at Getbean.
If scope= "prototype", whatever the value of Lazy-init will only be created when used, when Struts2 's
When the action and spring container are integrated, the action scope is set to prototype.
Spring Container life cycle:
Start the Spring container
Create a HelloWorld object
Call the Init method of the HelloWorld object, the Init method is called by the spring container inside the
Extract the HelloWorld object from the client, the object calls the method
When the spring container is closed, execute the Destroy method: Note: Prerequisites: Must be a singleton, if multiple instances, does not work.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Spring's IOC, spring object Initializes bean timing, spring container life cycle