首先說(shuō)任何xml文件本質(zhì)上都是一個(gè)標(biāo)簽哪审,標(biāo)簽內(nèi)部會(huì)嵌套子標(biāo)簽匾鸥。
web.xml的根標(biāo)簽就是<web-app>数尿。
文件內(nèi)標(biāo)簽的加載順序是:context-param -> listener -> filter -> servlet被冒。
contextConfigLocationclasspath:spring/applicationContext*.xml
context-param定義全局參數(shù)榨汤,這里是配置了Spring配置文件的位置蠕搜。
org.springframework.web.context.ContextLoaderListener
監(jiān)聽(tīng)器, 加載spring根環(huán)境 收壕。
過(guò)濾器妓灌,常見(jiàn)功能有監(jiān)控,或者編解碼蜜宪。
encodingFilterorg.springframework.web.filter.CharacterEncodingFilterencodingUTF-8forceEncodingtrueencodingFilter/*
加載springMVC環(huán)境(springmvc-servlet.xml)虫埂,并監(jiān)聽(tīng)/api/*路徑下的請(qǐng)求 。
springmvcorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:springmvc/springmvc-servlet.xmlspringmvc/api/*
入職新公司后圃验,大塊寫文章的時(shí)間不多掉伏,只能抓緊早晚。這篇文章本打算上上周末寫的澳窑,竟拖到現(xiàn)在斧散,其實(shí)也不麻煩。