WebsocketConfig.java 801 B

1234567891011121314151617181920212223242526
  1. package jnpf.message.config;
  2. import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  3. import org.springframework.boot.autoconfigure.condition.ConditionalOnNotWarDeployment;
  4. import org.springframework.context.annotation.Bean;
  5. import org.springframework.context.annotation.ComponentScan;
  6. import org.springframework.context.annotation.Configuration;
  7. import org.springframework.web.socket.server.standard.ServerEndpointExporter;
  8. @Configuration
  9. @ComponentScan
  10. @EnableAutoConfiguration
  11. public class WebsocketConfig {
  12. /**
  13. * 支持websocket
  14. * 如果不使用内置tomcat,则无需配置
  15. *
  16. * @return
  17. */
  18. @Bean
  19. @ConditionalOnNotWarDeployment
  20. public ServerEndpointExporter serverEndpointExporter() {
  21. return new ServerEndpointExporter();
  22. }
  23. }