3
請告訴我在spring mvc中是否可以同時使用SimpleUrlHandlerMapping和AnnotationMapping。spring - 使用SimpleUrlHandlerMapping和AnnotationMapping
謝謝。
請告訴我在spring mvc中是否可以同時使用SimpleUrlHandlerMapping和AnnotationMapping。spring - 使用SimpleUrlHandlerMapping和AnnotationMapping
謝謝。
是的,你可以儘可能多的你喜歡。每個人都會被諮詢,直到他們中的一個人說「是的,我有這個請求的映射」。
將它們中的每一個都像其他bean一樣聲明在bean文件中,它們將按照它們出現的順序進行查詢。
然而,在默認情況下,DispatcherServlet
寄存器三個不同HandlerMapping
豆自動,HttpRequestHandlerAdapter
,SimpleControllerHandlerAdapter
和AnnotationMethodHandlerAdapter
,所以這是可能的,你不需要做這你自己 - 你可以混合和匹配處理所有三種風格, Spring將會把它當成盒子來處理。