Equivalent of mvc:default-servlet-handler in Spring annotation-based configuration?

后端 未结 4 2384
野趣味
野趣味 2021-02-19 00:45

Is it possible to have the equivalent of defined in an AnnotationConfig(Web)ApplicationContext? Right now I have:<

4条回答
  •  既然无缘
    2021-02-19 01:06

    I don't think you can do it out of the box, but you can probably copy what DefaultServletHandlerBeanDefinitionParser does: Create a Bean of type DefaultServletHttpRequestHandler and map it to the URL scheme /**.

    I'd say your Bean should subclass DefaultServletHttpRequestHandler and do the mapping in a @PostConstruct method.

提交回复
热议问题