WebSocketConfig.java 623 B

12345678910111213141516171819202122232425
  1. package com.fdkankan.fusion.websocket;
  2. import org.slf4j.Logger;
  3. import org.slf4j.LoggerFactory;
  4. import org.springframework.context.annotation.Bean;
  5. import org.springframework.context.annotation.Configuration;
  6. import org.springframework.web.socket.config.annotation.EnableWebSocket;
  7. import org.springframework.web.socket.server.standard.ServerEndpointExporter;
  8. /**
  9. * SpringBoot + WebSocket 是用@ServerEndpoint注入,必须有此配置
  10. *
  11. */
  12. @Configuration
  13. public class WebSocketConfig {
  14. @Bean
  15. public ServerEndpointExporter serverEndpointExporter() {
  16. return new ServerEndpointExporter();
  17. }
  18. }