【发布时间】:2016-07-04 13:07:11
【问题描述】:
我正在尝试在 Spring Web 应用程序中添加 spring-websocket 依赖项。
我已经在 pom.xml 中添加了这个依赖:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>4.2.4</version>
</dependency>
我已经为@EnableWebSocketMessageBroker 创建了一个等效的XML 配置,如下所示:
所以,我有这个 spring-socket-context.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
<websocket:message-broker application-destination-prefix="/app">
<websocket:stomp-endpoint path="/myPath">
<websocket:sockjs/>
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic, /queue"/>
</websocket:message-broker>
</beans>
当我启动网络应用程序时,我立即出现此错误:
[ERROR] 2016-07-04 14:52:11,381 [] [] org.springframework.web.context.ContextLoader initWebApplicationContext - Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionParser for element [message-broker]
如何解决这个错误?
谢谢。
【问题讨论】:
标签: spring spring-mvc spring-websocket