1. 程式人生 > >加上mvc:resources後controller訪問404

加上mvc:resources後controller訪問404

之前因為靜態資源訪問,404,於是加上了類似的程式碼

<mvc:resources location="/resources/" mapping="/resources/**"/>

執行之後發現,Controller訪問404了

出現這樣的問題,在mvc:resources下加上mvc:annotation-driven即可

程式碼如下:

<mvc:resources location="/resources/" mapping="/resources/**"/>
<mvc:annotation-driven/>