gpt4 book ai didi

java - spring boot websocket配置错误

转载 作者:行者123 更新时间:2023-12-02 00:38:47 24 4
gpt4 key购买 nike

Caused by: java.lang.NoSuchMethodError: 'org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport.messageBrokerTaskScheduler()'

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws").setAllowedOrigins("https://localhost.com").withSockJS();
}

@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/aq-topic", "/aq-queue");
config.setApplicationDestinationPrefixes("/aq-broker");
}

@Override
public void configureClientInboundChannel(ChannelRegistration channelRegistration) {
channelRegistration.taskExecutor().corePoolSize(4).maxPoolSize(8);
}

@Override
public void configureClientOutboundChannel(ChannelRegistration channelRegistration) {
channelRegistration.taskExecutor().corePoolSize(4).maxPoolSize(8);
}

}

这是所附的屏幕截图

enter image description here

最佳答案

在 activeMQ 的 pom.xml 文件中添加了额外的依赖项,因此 AbstractMessageBrokerConfiguration 类是从 active-mq-all.jar 中选取的,而不是应该从 simp/spring-messaging.jar 中选取的。

删除外部 Active mq 依赖关系解决了我的问题。

关于java - spring boot websocket配置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57956588/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com