This commit is contained in:
GYJ
2024-06-19 15:28:24 +08:00
parent 56343b62b8
commit 17dde1ec59
2 changed files with 4 additions and 2 deletions

View File

@@ -3,9 +3,11 @@ package com.sqx;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
@EnableScheduling @EnableScheduling
@EnableWebSocket
@SpringBootApplication @SpringBootApplication
public class SqxApplication { public class SqxApplication {
@@ -21,4 +23,4 @@ public class SqxApplication {
} }
} }

View File

@@ -8,7 +8,7 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
* websocket的配置 * websocket的配置
*/ */
@Configuration @Configuration
public class WebSocketStompConfig{ public class WebSocketStompConfig {
//这个bean会自动注册使用了@ServerEndpoint注解声明的Websocket endpoint //这个bean会自动注册使用了@ServerEndpoint注解声明的Websocket endpoint
@Bean @Bean
public ServerEndpointExporter serverEndpointExporter() public ServerEndpointExporter serverEndpointExporter()