📜  spring websocket 允许来源 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:11.592000             🧑  作者: Mango

代码示例1
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfigurer extends WebSocketMessageBrokerConfigurer {

    @Override
    public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) {
        stompEndpointRegistry.addEndpoint("/ws").setAllowedOriginPatterns("*").withSockJS();
    }
  
      ...
}