解决
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
// the endpoint for websocket connections
registry.addEndpoint("/stomp").setAllowedOrigins("*").withSockJS();
}
// remaining config not shown as not relevant
}
来自:https://stackoverflow.com/questions/32874421/websocket-in-spring-boot-app-getting-403-forbidden