(类型转化的错误)java.lang.IllegalStateException:no matching editors or conversion strategy found

        今天小编在写SSM整合的时候,突然在项目启动的时候就报了下面这个错误。

Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.web.servlet.handler.MappedInterceptor#2’: Unsatisfied dependency expressed through constructor parameter 2: Could not convert argument value of type [cn.beyondFlateForm.interceptor.SysInterceptor] to required type [org.springframework.web.context.request.WebRequestInterceptor]: Failed to convert value of type ‘cn.beyondFlateForm.interceptor.SysInterceptor’ to required type ‘org.springframework.web.context.request.WebRequestInterceptor’; nested exception is java.lang.IllegalStateException: Cannot convert value of type ‘cn.beyondFlateForm.interceptor.SysInterceptor’ to required type ‘org.springframework.web.context.request.WebRequestInterceptor’: no matching editors or conversion strategy found

        之前小编在做项目的时候也没有报这个错误,今天突然就报了这个错误,很神奇,而且报错信息还那么长,真是看了一遍又一遍,害。看到最后两句英文报错信息,大概知道了是类型转换错误。然后我就找“springmvc-servlet”的配置文件,里面有一个拦截器的配置,如下:

	<mvc:interceptors>
        <mvc:interceptor>
            <mvc:mapping path="/manager/backend/**"/>
            <mvc:mapping path="/dev/flatform/**"/>
            <bean class="cn.beyondFlateForm.interceptor.SysInterceptor"/>
        </mvc:interceptor>

    </mvc:interceptors>

接着找到SysInterceptor这个方法,点进去,看到代码才知道错在哪了

public class SysInterceptor {
}

        这个类是要继承一个父类HandlerInterceptorAdapter的,怪不得会出现类型转换错误呢。以后啊,敲代码的时候一定要认真仔细,千万不要因为一个小细节而浪费几十分钟的时间找一个不该出的bug。

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

梦梦~~

你的鼓励是对我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值