WebSocketConfig.java 547 B

123456789101112131415161718192021
  1. package com.gyee.alarm.websocket;
  2. import org.springframework.context.annotation.Bean;
  3. import org.springframework.context.annotation.Configuration;
  4. import org.springframework.web.socket.server.standard.ServerEndpointExporter;
  5. /**
  6. * 功能描述:
  7. * 开启websocket支持
  8. * @Date: 2022-12-01 09:40:15
  9. * @since: 1.0.0
  10. */
  11. @Configuration
  12. public class WebSocketConfig {
  13. // 使用boot内置tomcat时需要注入此bean
  14. @Bean
  15. public ServerEndpointExporter serverEndpointExporter() {
  16. return new ServerEndpointExporter();
  17. }
  18. }