Spring BeanNameUrlHandlerMapping自动探测问题

BeanNameUrlHandlerMapping 会自动探测 '/' 开头的bean当做是一个handler,但默认是只探测当前context里的bean,不会探测ancestor contexts(父容器),如果要探测父容器,那么设置detectHandlersInAncestorContexts为true。代码如下:

<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
 		<property name="order" value="1" />
 		<property name="detectHandlersInAncestorContexts" value="true"></property>
</bean>

猜你喜欢

转载自zheng19851.iteye.com/blog/2166542