java - mvc :annotation-driven in dispatcher servlet configuration 内的冲突

标签 java spring-mvc ant websocket atmosphere

我试图将 atmosphere websockets maven 项目集成到 spring ant 项目中。但是在配置时,似乎在 bean 实例化中引发了一些冲突。

这是我的调度程序 servlet

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
    <property name="messageConverters">
        <list>
            <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"/>
        </list>
    </property>
</bean>


<mvc:annotation-driven>
    <mvc:argument-resolvers>
        <beans:bean class="com.project.AtmosphereArgumentResolver" />
    </mvc:argument-resolvers>
</mvc:annotation-driven>

这是显示的错误:

Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.atmosphere.cpr.AtmosphereResource]: Specified class is an interface

最佳答案

没错! org.atmosphere.cpr.AtmosphereResource 是一个接口(interface)所以异常(exception)。 Spring 正在尝试实例化 bean org.atmosphere.cpr.AtmosphereResource,它应该是一个类,但它是一个接口(interface)。您不能实例化接口(interface)。您需要提供org.atmosphere.cpr.AtmosphereResource的实现类。

关于java - mvc :annotation-driven in dispatcher servlet configuration 内的冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12507854/

相关文章:

java - Ant gwtcompile ClassNotFoundException

java - 如何扩展 JPA 实体以仅添加组合

java - 如何在 spring-boot 中分离前端和后端机器?

java - Spring 没有匹配类型的 bean,预计至少有 1 个 bean

mysql - Ant构建文件找不到mysql程序

xml - 为什么在使用 "ant"命令 build.xml 时出现导入错误?

java - 为什么我的变量不返回答案?

java - CriteriaQuery 带 max 的子查询

java - 如何打印两列循环

spring - @RequestParam,名称与值属性