FAQ: Web / Spring

Servlet life cycle

init () initialization phase

  • Servlet Servlet Container loading (the web.xml has load-on-startup = 1; Servlet container after the first start requesting the user to Servlet; Servlet class file is updated reloaded)
  • Creating a Servlet container Servlet examples and call init () method

service () client request stage

  • Client sends a request
  • Servlet generate a new thread
  • Servlet create specific request of ServletRequest, ServletResponse
  • Call service () method responds to the request, such as the HttpServlet doPost, doGet

destroy () termination phase

When the web application termination / Servlet container terminate / Servlet Servlet examples reloaded, Servlet calls the destroy () method.

Spring Bean Lifecycle

  • Bean instantiation
  • Set the object properties (IOC injection)
  • Aware check and set the associated dependent interfaces
  • BeanPostProcess pre-processing
  • Check whether InitializingBean to decide whether to call afterPropertiesSet
  • Check for a custom init-method (configuration file can be defined)
  • BeanPostProcess post-processing
  • Registration Destruction-related callback interface
  • Bean Ready
  • use
  • The call DispostbleBean destroy to destroy Bean
  • Call custom methods of destruction

Guess you like

Origin www.cnblogs.com/cielosun/p/11576597.html