造成原因: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);
}
}
这是附件的截图
最佳答案
在activeMQ的pom.xml文件中添加了附加的依赖项,因此从active-mq-all.jar中选择了AbstractMessageBrokerConfiguration类,而应该从simp / spring-messaging.jar中进行了选择。
删除外部Active mq依赖关系解决了我的问题。