我正在从Spring 2.5迁移到Spring 3.
他们介绍了<mvc:annotation-driven />哪些黑魔法.这应该只在servlet配置文件中声明.
在Spring 2.5中,我刚刚使用<context:annotation-config />和<context:component-scan base='...'/>标记声明application-context.xml和调度程序servlet配置XML以及适当的基础包进行扫描.
所以,我不知道是什么样的区别mvc:annotation-driven,并context:annotation-config在servlet配置标签和我有什么可以消除在春季3配置文件?
我在我的REST API中使用文件名(例如:GET http://xxx/api/myImage.jpg)问题是@PathVariable丢弃".jpg".这个问题已经在这里问过几次并回答了.但对我不起作用.
所以我搜索了然后发现了
https://jira.springsource.org/browse/SPR-6524
"......根本不应该与手动DefaultAnnotationHandlerMapping实例结合使用;这被设计为目前的一种或两种选择,非常类似于和."
"mvc名称空间是简化配置".
真正的问题是mvc做了什么?并改变了?
我发现自己这些东西..
还有其他人?
提前致谢!
早上,我已经检查了这个问题的大多数答案(在带有名称的DispatcherServlet中找不到带有URI的HTTP请求的映射)以及在DispatcherServlet中找不到带有URI [/ ChickenTest/index]的HTTP请求的映射名称'dispatcherServlet')但我仍然得到"在DispatcherServlet中找不到带有URI [/ bmoa-surrounds/bmoa]的HTTP请求的映射,名称为'bmoa'",因此,任何帮助都应该是apreciated:
POM:
<dependencies>
<!-- Junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- Testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<!-- Log4j -->
<dependency> …Run Code Online (Sandbox Code Playgroud)