我正在从Spring 3.0将我的proj升级到spring 4.x.因此,我使用旧类(DefaultAnnotationHandlerMapping& AnnotationMethodHandlerAdapter)中的新类更新了我的beans.xml。我假设,我遇到的问题是我在Spring 4.x中处理RequestMappingHandlerMapping的方式
<code>
<bean
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"
p:interceptors-ref="threadSessionDataInterceptor" />
<bean
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="stringMarshallingConverter"/>
<ref bean="jsonMarshallingConverter"/>
<ref bean="xmlMarshallingConverter"/>
<ref bean="xmlMarshallingConverter2"/>
</list>
</property>
</bean>
</code>
当我升级到spring 4.x后启动服务器时,我在stacktrace中收到以下INFO消息,它会抛出异常。
11:19:30,879 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping](ServerService Thread Pool - 48)将“{[/sample/validateexample.json]}”映射到公共虚空com.fnservice.web.VerificatonController.addNotes(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.springframework.ui.Model)抛出java .lang.Exception
11:19:30,915 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping](ServerService Thread Pool - 48)Mapped“{[/init/doInitialConfig.json],methods=[GET ]}“on public void com.fnservice.web.InitialConfController.doInitialConfig(org.springframework.ui.Model)throws java.lang.Exception
下面,我提到了服务器抛出java.lang.Exception的VerificationController类的java代码。
<code>
@Controller
@RequestMapping("/sample/*")
public class AdVerificationController {
private final static Log log = LogFactory.getLog(AdVerificationController.class);
@Autowired
AdVerificationService adVerificationService;
@RequestMapping(value = "validateexample.json")
public void addNotes(@RequestParam(value = "validateLane1", required = false)String Line1,
@RequestParam(value = "validateLane2", required = false)String Line2,
@RequestParam(value = "validateTe", required = false)String Te,
Model model)throws Exception {
{
AddXML add = new AddXML();
VerificationXML VerificationResponse = new AddVerificationXML();
......... rest of code
但是,当我使用Spring 3.0运行相同的代码时,它不会抛出任何异常。请告诉我这里是否做错了。 我正在使用Spring 3.0运行时粘贴堆栈跟踪。
18:17:09,113 INFO [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping](ServerService线程池 - 55)将映射的URL路径[/address/validateExample.json]映射到处理程序'VerificationController'上
18:17:09,129 INFO [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping](ServerService Thread Pool - 55)将映射的URL路径[/init/doInitialConfig.json]映射到处理程序'initialConfController'上