Alibaba cloud Q & A 2022-02-13 06:13:02 阅读数:715
tomcat How containers are created servlet Class instance ?
When the container starts , Will read in webapps All the web In application web.xml file , Then on xml File parsing , And read servlet Registration information . then , Register... In each app servlet Classes are loaded , And pass Instantiate the way of reflection .( Sometimes it's also instantiated on the first request )
stay servlet Sign up with 1 If it's a positive number , Instantiate at the beginning , If it's not written or negative , The first request for instantiation .
copyright:author[Alibaba cloud Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130613011093.html