问题
I am using spring-WebSocket for receiving records via WebSocket channel. After receiving them I send it to an external broker like activeMQ.
My configuration looks something like:
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic");
registry
.enableStompBrokerRelay("/topic","/queue")
.setRelayHost("127.0.0.1")
.setRelayPort(61613);
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/gs-guide-websocket").withSockJS();
}
}
This works well. Now I am trying to integrate this with a parent project where I get a conflict about multiple beans of type SimpMessagingTemplate being registered. This fails the injection process in the parent application.
I tried overriding the classes to create my template outside spring context but failed to do so.
Any insights would be great.
来源:https://stackoverflow.com/questions/55016259/problem-with-broker-template-in-spring-websocket