等效于基于Spring注释的配置中的mvc:default-servlet-handler?
2022-09-02 20:09:55
是否有可能在 ?现在我有:<mvc:default-servlet-handler/>
AnnotationConfig(Web)ApplicationContext
@Configuration
@ImportResource("classpath:/mvc-resources.xml")
class AppConfig {
// Other configuration...
}
在我的:resources/mvc-resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<mvc:default-servlet-handler/>
</beans>
它按预期工作。是否可以在不导入 XML 文件的情况下执行此操作?这将是减少一些样板的好方法。